错误:找不到所有 Meteor 命令在控制台中抛出的模块“下划线”
在每个 meteor 或陨石命令(例如 meteor
或 mrt create myapp
之后,都会抛出以下错误。这个错误似乎是突然出现的,因为 meteor 在前一天晚上就可以正常工作,此后没有进行任何更改。
Austins-MacBook-Pro:Projects austinrivas$ mrt create test-app
/Users/austinrivas/.meteor/tools/3cba50c44a/tools/meteor.js:1480
}).run();
^
Error: Cannot find module 'underscore'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at /Users/austinrivas/.meteor/tools/3cba50c44a/tools/meteor.js:10:11
我已经尝试使用 sudo npm install -g underscore
手动安装下划线
Austins-MacBook-Pro:Projects austinrivas$ sudo npm install -g underscore
Password:
npm http GET https://registry.npmjs.org/underscore
npm http 200 https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/underscore/-/underscore-1.5.2.tgz
npm http 200 https://registry.npmjs.org/underscore/-/underscore-1.5.2.tgz
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/cordova requires colors@'>=0.6.0' but will load
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/node-static requires colors@'>=0.6.0' but will load
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
underscore@1.5.2 /usr/local/share/npm/lib/node_modules/underscore
我的 ~/.bash_profile 有以下路径
export PATH=/usr/local/share/npm/bin:$PATH
export NODE_PATH="/usr/local/share/npm/lib/node_modules"
export NODE_OPTIONS="--debug"
我什至尝试过重新安装 Node 并执行 npm 缓存清理
,但我不确定还能尝试什么。
任何进一步的见解将不胜感激。
更新
运行 npm list -g underscore
返回以下内容
Austins-MacBook-Pro:~ austinrivas$ npm list -g underscore
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/cordova requires colors@'>=0.6.0' but will load
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/node-static requires colors@'>=0.6.0' but will load
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
/usr/local/share/npm/lib
├─┬ meteorite@0.6.11
│ ├─┬ ddp@0.3.4
│ │ └─┬ meteor-ejson@0.6.3
│ │ └── underscore@1.4.4
│ └── underscore@1.5.1
├─┬ phonegap@3.0.0-0.14.0
│ └─┬ cordova@3.0.0
│ ├─┬ follow-redirects@0.0.3
│ │ └── underscore@1.5.1
│ └─┬ plugman@0.9.10
│ ├─┬ dep-graph@1.1.0
│ │ └── underscore@1.2.1
│ └── underscore@1.4.4
├── underscore@1.5.2
└─┬ ungit@0.1.8
└── underscore@1.4.4
最佳答案
我能够通过以下步骤完全卸载/重新安装 meteor
和 meteorite
来解决此错误。
sudo rm /usr/local/bin/meteor
rm -rf ~/.meteor
sudo mrt uninstall
sudo mrt uninstall --system
sudo chown -R `whoami` ~/.npm
curl https://install.meteor.com | /bin/sh
sudo -H npm install -g meteorite
我能够通过运行 meteor --version
和 mrt create test-app
验证一切正常工作
关于javascript - 错误 : Cannot find module 'underscore' thrown in console for all Meteor commands,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18678924/