【问题标题】:Angular2 - Not looking in 'node_modules' for specific ModuleAngular2 - 不寻找特定模块的“node_modules”
【发布时间】:2017-03-28 02:48:43
【问题描述】:

我正在尝试实现 Firebase 对 Google、Twitter 等的授权。

按照this 指导,显示我调用以下命令

npm install angularfire2 firebase --save
npm install @types/firebase`

并将其添加到tsconfig.json

"typeRoots": [
      "../node_modules/@types"
    ],
    "types": [
      "jasmine",
      "firebase",
      "node"
    ]

现在我遇到的问题是,当尝试从 angularfire2 模块导入类/模块时,我的浏览器在 localhost:3000/angularfire2 上返回 404,而所有其他 node_modules 都从 localhost:3000/node_modules/... 成功检索我如何确保我的应用会查看 node_modules 的这个特定电话吗?

(按照上面提到的指南中的每一条说明进行操作——所有代码都完全相同,如果需要,我可以从我自己的代码或文件树中提供它(如果需要)。

【问题讨论】:

  • 你用webpack还是systemjs?
  • @smnbbrv systemjs

标签: angular firebase firebase-authentication node-modules


【解决方案1】:

您还应该让 systemjs 了解这些模块。

转到您的 systemjs 配置并在其中为您的库添加一个映射。更多信息请查看systemjs documentation

类似:

...
var map = {
  ...
  'angularfire2': 'node_modules/angularfire2',
  'firebase ': 'node_modules/firebase',
  ...    
};
...
...
var packages = {
  ...
  'angularfire2': { main: 'index.js', defaultExtension: 'js' },
  ...
};
...

检查路径是否为 node_modules 中的正确路径。

【讨论】:

    猜你喜欢
    • 2018-09-17
    • 2016-04-14
    • 2016-10-05
    • 2014-09-18
    • 2016-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多