比如我安装bower
npm install bower -g
请问如何解决这样的问题?
提示如下
> lodash[@0](/user/0).9.2 install /usr/local/lib/node_modules/bower/node_modules/lodash
> node build/post-install
npm ERR! TypeError: options.uid should be a number
npm ERR! at ChildProcess.spawn (child_process.js:782:24)
npm ERR! at Object.exports.spawn (child_process.js:618:9)
npm ERR! at spawn (/usr/local/lib/node_modules/npm/lib/utils/exec.js:103:22)
npm ERR! at exec (/usr/local/lib/node_modules/npm/lib/utils/exec.js:40:12)
npm ERR! at /usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:146:5
npm ERR! at process.startup.processNextTick.process._tickCallback (node.js:244:9)
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-[@googlegroups](/user/googlegroups).com>
npm ERR!
npm ERR! System Darwin 12.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "bower" "-g"
npm ERR! cwd /private/var/root/spm
npm ERR! node -v v0.8.14
npm ERR! npm -v 1.1.16
npm ERR! message options.uid should be a number
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/root/spm/npm-debug.log
npm not ok
17 回复
我使用了sudo,结果还是报错了
sudo npm install bower -g
npm http GET https://registry.npmjs.org/bower
#省略部分GET请求...
> [email protected] install /usr/local/lib/node_modules/bower/node_modules/lodash
> node build/post-install
npm ERR! TypeError: options.uid should be a number
npm ERR! at ChildProcess.spawn (child_process.js:782:24)
npm ERR! at Object.exports.spawn (child_process.js:618:9)
npm ERR! at spawn (/usr/local/lib/node_modules/npm/lib/utils/exec.js:103:22)
npm ERR! at exec (/usr/local/lib/node_modules/npm/lib/utils/exec.js:40:12)
npm ERR! at /usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:146:5
npm ERR! at process.startup.processNextTick.process._tickCallback (node.js:244:9)
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <[email protected]>
npm ERR!
npm ERR! System Darwin 12.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "bower" "-g"
npm ERR! cwd /private/var/root/spm
npm ERR! node -v v0.8.14
npm ERR! npm -v 1.1.16
npm ERR! message options.uid should be a number
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/root/spm/npm-debug.log
npm not ok
谢谢,安装成功了。用的方法是 npm install bower
我不明白之前有什么问题,可能有两个 1.用户不同,之前我使用的是root账户,今天我安装的是机器用户名 2.安装方法不同 今天用的是:npm install bower 前两天用的是: sudo npm install bower -g 和 npm install bower
请问是可能会是什么原因呢?
@yuchen 也不清楚,我的办法是可以不 install -g 就不用, -g 只用在下面这些:
npm install coffee-script -g npm install mocha -g
其他都只用: npm install moduename
@venngomez 我安装的结尾有两个警告
npm WARN package.json [email protected] No README.md file found!
npm WARN prefer global [email protected] should be installed with -g
[email protected] node_modules/spm
上面第二行说要使用 -g,请问这样是安装正确了吗?按道理是安装成功的,但是我的环境变量中是没有spm的
我试着重新安装,使用
npm install spm -g
结果报错了
@venngomez 嗯,是的,不过我还经历了一个过程,备注下来吧,如果有同样问题的朋友可以留意。
- OS X下root账户是停用的
- su root 可能会报告su Sorry
- 解决方法是 系统设置 - 用户和群组 - 解锁 - 登录选项 - 加入 - 打开目录实用工具 - 解锁 - 顶部工具栏“编辑” - 启用root账户
我是OS X10.8.2 谢谢@venngomez 帮忙解决问题