我在 ubuntu 14.04 上通过源代码安装 nodejs 和 npm。
root@wemet:~/ang# npm version
{ http_parser: '1.0',
node: '0.10.34',
v8: '3.14.5.9',
ares: '1.9.0-DEV',
uv: '0.10.30',
zlib: '1.2.8',
modules: '11',
openssl: '1.0.1j',
npm: '1.4.28' }
我安装了 yo 并生成角度作为全局 这是我本地的完整软件包安装:https://gist.github.com/thinksource/ba33f0cad073f3d4dc46
当我想做:
root@wemet:~/ang# yo angular
module.js:340
throw err;
^
Error: Cannot find module '../../string/is-string'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/yo/node_modules/insight/n
ode_m odules/inquirer/node_modules/cli-color/node_modules/es5-ext/array/from/shim
.js:9:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
我不知道什么是字符串模块。我在 https://www.npmjs.com/检查了一下,但找不到。
当我干净地运行鲍尔缓存时:
root@wemet:~/ang# npm i make-iterator --save-dev
info trying registry request attempt 1 at 00:21:04
http GET https://registry.npmjs.org/make-iterator
http 200 https://registry.npmjs.org/make-iterator
info trying registry request attempt 1 at 00:21:04
http GET https://registry.npmjs.org/for-own
http 200 https://registry.npmjs.org/for-own
info trying registry request attempt 1 at 00:21:05
http GET https://registry.npmjs.org/for-in
http 200 https://registry.npmjs.org/for-in
make-iterator@0.1.1 node_modules/make-iterator
└── for-own@0.1.2 (for-in@0.1.3)
root@wemet:~/ang# bower cache clean
module.js:340
throw err;
^
Error: Cannot find module '../function/makeIterator_'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/bower/node_modules/mout/
rray/collect.js:2:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
我找到了模块制作迭代器,但即使我安装了制作迭代器,当我运行 bower 缓存干净时仍然会遇到错误。
我遇到了问题,我需要将我的 npm 版本从 1.4.28 升级到 2.1.2。感谢您的关注。
@user504909的答案将解决问题 但是好的解决方案是将Nodejs
版本从0.10.34
升级到0.12.0
作为升级Nodejs
版本的结果,npm
版本也将从1.4.28
升级到2.1.2
根据nodesource博客升级Nodejs
版本:
# Note the new setup script name for Node.js v0.12
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
# Then install with:
sudo apt-get install -y nodejs
有关使用Ubuntu
操作系统升级Nodejs
版本的回答 ->请参阅此链接