我目前在windows7上尝试安装nodejs和npm,以便与git和yeoman一起使用。我已经卸载了node和git多次,但仍然得到相同的错误
`Welcome to Git (version 1.9.4-preview20140815)
Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.
Jeff@JEFF-PC ~
$ node --version
v0.10.32
Jeff@JEFF-PC ~
$ npm --version
1.4.28
Jeff@JEFF-PC ~
$ npm install --global yo
c:\UsersJeffnpm\yo -> c:\UsersJeffnpm\node_modules\yo\cli.js
> yo@1.2.1 postinstall c:\UsersJeffnpm\node_modules\yo
> node ./scripts/doctor
[Yeoman Doctor] Uh oh, I found potential errors on your machine
---------------
[Error] npm root value is not in your NODE_PATH
[info]
NODE_PATH = :\Users\Jeff\npm\node_modules:\home\npm\lib\node_modules
npm root = c:\UsersJeffnpm\node_modules
[Fix] Append the npm root value to your NODE_PATH variable
If you're using cmd.exe, run this command to fix the issue:
setx NODE_PATH "%NODE_PATH%;c:\UsersJeffnpm\node_modules"
Then restart your command line. Otherwise, you can setup NODE_PATH manually:
https://github.com/sindresorhus/guides/blob/master/set-environment-variabl
es.md#windows
我尝试了yeoman医生建议的命令,并尝试手动编辑环境变量,但不断收到这些错误。我需要编辑我的.bashrc或.gitconfig文件吗?
以下是我的.bashrc内容:
export PATH=$PATH:/usr/local/bin
export NODE_PATH=:/Users/Jeff/npm/node_modules
export NODE_PATH=:/Users/Jeff/npm/node_modules:/home//npm/lib/node_modules
如果我可以更改我的环境变量或编辑我的路径,请让我知道!我非常感谢您的帮助!
发布于 2014-09-29 22:59:57
在您的.bashrc
的第二行中,您将注意到您有/home//npm/lib/node_modules
。基于该文件中的其他项,我打赌它应该是/Users/Jeff/npm/lib/node_modules
或类似的。
https://stackoverflow.com/questions/26110199
复制相似问题