meteor create throws error:module.js:549无法为测试包安装npm依赖项

时间:2018-06-02 10:00:07

标签: meteor npm

当我尝试运行meteor create boilerplate时,屏幕上显示以下信息。我做了一些研究,得出了一个我在下面发布的答案。花了一些时间来解决这个问题,我正在分享我的解决方案,希望能帮助别人。

这是整个错误。

/Users/user/.meteor/packages/meteor-tool/.1.6.1_1.o8hqcq.5zvm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:218
      throw error;
      ^

Error: Error: Could not install npm dependencies for test-packages: Command failed: /Users/user/.meteor/packages/meteor-tool/.1.6.1_1.o8hqcq.5zvm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm install --production=false
module.js:549
    throw err;
    ^

Error: Cannot find module '../lib/utils/unsupported.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /Users/user/.meteor/packages/meteor-tool/.1.6.1_1.o8hqcq.5zvm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm:19:21
    at Object.<anonymous> (/Users/user/.meteor/packages/meteor-tool/.1.6.1_1.o8hqcq.5zvm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm:92:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
module.js:549
    throw err;
    ^

Error: Cannot find module '../lib/utils/unsupported.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /Users/user/.meteor/packages/meteor-tool/.1.6.1_1.o8hqcq.5zvm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm:19:21
    at Object.<anonymous> (/Users/user/.meteor/packages/meteor-tool/.1.6.1_1.o8hqcq.5zvm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm:92:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)

    at Object.error (/tools/utils/buildmessage.js:430:11)
    at /tools/cli/default-npm-deps.js:36:20
    at /tools/utils/buildmessage.js:334:18
    at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:333:36
    at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.enterJob (/tools/utils/buildmessage.js:324:26)
    at Object.install (/tools/cli/default-npm-deps.js:27:27)
    at Command.func (/tools/cli/commands.js:801:36)

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

要解决此问题,我首先使用以下命令卸载节点:

brew uninstall node; 
# or `brew uninstall --force node` which removes all versions
brew prune;
rm -f /usr/local/bin/npm /usr/local/lib/dtrace/node.d;
rm -rf ~/.npm;

然后使用以下方法重新安装节点:

brew install node;
which node # => /usr/local/bin/node
export NODE_PATH='/usr/local/lib/node_modules' # <--- add this ~/.bashrc

然后我使用以下内容删除了Meteor:

sudo rm /usr/local/bin/meteor
rm -rf ~/.meteor

修复权限:

sudo chown -R $(whoami) ~/.npm

然后重新安装Meteor:

curl https://install.meteor.com/ | sh

现在,错误消失了!

来源:

  1. How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
  2. How can I completely uninstall and then reinstall Meteor.js?