使用featherjs依赖项的Aurelia无法正确导入
如何使用Aurelia项目中常见的样式导入featherjs。这就是我所拥有的: 在构建文件aurelia.json中使用featherjs依赖项的Aurelia无法正确导入,aurelia,feathersjs,Aurelia,Feathersjs,如何使用Aurelia项目中常见的样式导入featherjs。这就是我所拥有的: 在构建文件aurelia.json中 "dependencies": [ { "name": "socket.io-client", "path": "../node_modules/socket.io-client/dist/socket.io.min" }, { "name": "feathers", "path
"dependencies": [
{
"name": "socket.io-client",
"path": "../node_modules/socket.io-client/dist/socket.io.min"
},
{
"name": "feathers",
"path": "../node_modules/feathers",
"main": "client",
"env": "dev"
},
"aurelia-binding",
在app.js中
import io from 'socket.io-client';
import feathers from 'feathers';
//import socketio from 'feathers-socketio';
export class App {
constructor() {
this.message = 'Hello World!';
console.log("startup");
const socket = io('http://localhost:3030');
const app = feathers();
// .configure(socketio(socket));
}
}
错误如下所示:
Starting 'readProjectConfiguration'...
Finished 'readProjectConfiguration'
Starting 'processMarkup'...
Starting 'processCSS'...
Starting 'configureEnvironment'...
Finished 'processCSS'
Finished 'processMarkup'
Finished 'configureEnvironment'
Starting 'buildJavaScript'...
Finished 'buildJavaScript'
Starting 'writeBundles'...
Tracing app...
{ uid: 8,
name: 'writeBundles',
branch: false,
error:
{ [Error: ENOENT: no such file or directory, open '/Users/steve/project/src/uberproto.js']
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Users/steve/project/src/uberproto.js',
moduleTree: [ 'feathers/lib/feathers' ],
fileName: '/Users/steve/project/node_modules/feathers/lib/feathers.js' },
duration: [ 0, 161365129 ],
time: 1484844203606 }
{
"name": "socket.io-client",
"path": "../node_modules/socket.io-client/dist",
"main": "socket.io.min"
}
一旦它开始处理依赖项,它在featherjs中寻找依赖项时似乎遇到了路径混乱。我对这些东西还很陌生,所以它可能很简单,但我还没有找到包含此依赖项的正确方法。您缺少
main
属性。配置应如下所示:
Starting 'readProjectConfiguration'...
Finished 'readProjectConfiguration'
Starting 'processMarkup'...
Starting 'processCSS'...
Starting 'configureEnvironment'...
Finished 'processCSS'
Finished 'processMarkup'
Finished 'configureEnvironment'
Starting 'buildJavaScript'...
Finished 'buildJavaScript'
Starting 'writeBundles'...
Tracing app...
{ uid: 8,
name: 'writeBundles',
branch: false,
error:
{ [Error: ENOENT: no such file or directory, open '/Users/steve/project/src/uberproto.js']
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Users/steve/project/src/uberproto.js',
moduleTree: [ 'feathers/lib/feathers' ],
fileName: '/Users/steve/project/node_modules/feathers/lib/feathers.js' },
duration: [ 0, 161365129 ],
time: 1484844203606 }
{
"name": "socket.io-client",
"path": "../node_modules/socket.io-client/dist",
"main": "socket.io.min"
}
我相信您要安装的是feathers客户端,而不是feathers aurelia.json:
{
"name": "socket.io-client",
"path": "../node_modules/socket.io-client/dist/socket.io.min"
},
{
"name": "feathers-client",
"path": "../node_modules/feathers-client/dist",
"main": "feathers"
}
app.js:
import io from 'socket.io-client';
import feathers from 'feathers-client';
export class App {
constructor() {
const socket = io('http://localhost:3030');
const app = feathers().configure(feathers.socketio(socket));
}
}
实际上,这个依赖关系工作得很好,feathersjs依赖关系出现了问题,就是这样。现在我只需要找出最后一个依赖项,即注释的依赖项。