使用feathers-authentication-client

时间:2017-03-08 03:27:16

标签: aurelia feathersjs

我在我的aurelia.json文件中添加了一个npm包

{
    "name": "feathers-authentication-client",
    "path": "../node_modules/feathers-authentication-client/lib",
    "main": "index"
}

然后我导入它

import * as auth from 'feathers-authentication-client';

但我一直收到这个错误:

{ Error: ENOENT: no such file or directory, open 'C:\path\to\project-folder\src\feathers-errors.js' ...

如果我也将此包添加到aurelia.json,那么我会得到相同的错误,但是依赖于feathers-errors等等。

1 个答案:

答案 0 :(得分:2)

感谢@AshleyGrant对此有所帮助。这是解决方案:

  • 确保您在dependencies文件

    中的aurelia.json下有此内容
    {
      "name": "feathers-client",
      "path": "../node_modules/feathers-client/dist",
      "main": "feathers"
    },
    {
      "name": "feathers-authentication-client",
      "main": "lib/index",
      "path": "../node_modules/feathers-authentication-client",
      "resources": []
    },
    "feathers-errors",
    "ms",
    {
      "name": "debug",
      "main": "browser",
      "path": "../node_modules/debug"
    },
    {
      "name": "jwt-decode",
      "main": "index",
      "path": "../node_modules/jwt-decode/lib",
      "resources": ["base64_url_decode.js", "atob.js"]
    }