【问题标题】:Deploy fails with "Error: Can't find npm module" in Meteor Galaxy部署失败,在 Meteor Galaxy 中出现“错误:找不到 npm 模块”
【发布时间】:2018-03-03 09:55:04
【问题描述】:

我尝试部署到 Meteor Galaxy,但它根本不起作用,尽管一切似乎都在 localhost 上运行。

起初,我的应用程序已上传,但无法启动。至少,容器现在开始了,但我的应用程序崩溃了。我认为这是我的应用程序结构中的系统性失败。也许 package.json 中缺少一些 npm 依赖项,或者我需要调试一些 npm 安装?

我认为我没有完全理解 npm 在 Meteor 中的工作方式,我需要拥有哪些依赖项,或者我必须导入/需要什么才能正确使用 npm 包。流星文档没有帮助。

这是我的错误日志:

Note: you are using a pure-JavaScript implementation of bcrypt.
While this implementation will work correctly, it is known to be
approximately three times slower than the native implementation.
In order to use the native implementation instead, run

 meteor npm install --save bcrypt

in the root directory of your application.
/app/bundle/programs/server/node_modules/fibers/future.js:280
    throw(ex);
    ^

Error: Can't find npm module 'meteor/browser-policy-common'. Did you forget to call 'Npm.depends' in package.js within the 'modules-runtime' package?
 at Object.require (/app/bundle/programs/server/boot.js:230:17)
 at makeInstallerOptions.fallback (packages/modules-runtime.js:641:18)
 at require (packages/modules-runtime.js:234:16)
 at meteorInstall.imports.startup.server.browser-policy.js (imports/startup/server/browser-policy.js:1:32)
 at fileEvaluate (packages/modules-runtime.js:333:9)
 at require (packages/modules-runtime.js:228:16)
 at meteorInstall.imports.startup.server.index.js (imports/startup/server/index.js:1:66)
 at fileEvaluate (packages/modules-runtime.js:333:9)
 at require (packages/modules-runtime.js:228:16)
 at meteorInstall.server.main.js (server/main.js:1:14)
 at fileEvaluate (packages/modules-runtime.js:333:9)
 at require (packages/modules-runtime.js:228:16)
 at /app/bundle/programs/server/app/app.js:3668:1
 at /app/bundle/programs/server/boot.js:338:34
 at Array.forEach (native)
 at Function._.each._.forEach (/app/bundle/programs/server/node_modules/underscore/underscore.js:79:11)

缺少哪个模块并不重要,似乎 Galaxy 找不到任何使用的 npm 模块。在那次尝试之前,我在另一个 npm 模块上遇到了同样的错误。比我刚刚在我的代码中删除该模块的 Npm.require 。现在,我有同样的错误,只是另一个模块。

我想我在本地使用 npm 时遗漏了一些东西。我是一个完整的初学者。在本地一切正常,现在我无法将其带到网上。我正在使用 Windows。

【问题讨论】:

  • 你能出示你的package.json吗?
  • 非常感谢,我想我现在知道你要去哪里了。这是一个普遍的问题,因为我在添加 npm 包时从未使用过 --save 标志,因此在我的 package.json 中没有它们的依赖项。我删除了 node_modules 并为每个 npm 包运行了 meteor npm install --save 并且错误已经消失(另外我出于其他原因删除了 browser-policy 包)。但是,现在托管应用程序时,我在浏览器控制台在线收到错误...也许您也知道如何解决这个问题?我会很感激你的帮助。我在原帖中添加了更新部分,谢谢!
  • 很高兴您能够自己解决问题,但我建议您关闭此问题并打开另一个问题。

标签: node.js meteor deployment npm npm-install


【解决方案1】:

这是一个普遍的问题,因为我在添加 npm 包时从未使用过--save 标志,因此在我的package.json 中没有它们的依赖关系。我删除了 node_modules 并为每个 npm 包运行了 meteor npm install --save 并且错误已经消失(另外我出于其他原因删除了 browser-policy package)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-10-13
    • 2018-01-22
    • 2013-03-02
    • 2013-07-28
    • 2014-05-25
    • 1970-01-01
    • 2019-03-08
    • 2022-01-20
    相关资源
    最近更新 更多