【问题标题】:Why do I keep getting errors with NodeJs and npm when installing yeoman?为什么我在安装 yeoman 时不断收到 NodeJs 和 npm 错误?
【发布时间】:2014-11-24 10:53:43
【问题描述】:

我目前在 Windows 7 上尝试安装 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

如果我可以更改我的环境变量或编辑我的路径,请告诉我!非常感谢您的帮助!

【问题讨论】:

    标签: node.js git npm yeoman git-bash


    【解决方案1】:

    .bashrc 的第二行中,您会注意到您有/home//npm/lib/node_modules。根据该文件中的其他项目,我打赌它应该是 /Users/Jeff/npm/lib/node_modules 或类似的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-08
      • 2010-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多