在"npm install -g yo"时失败?



我正在尝试安装Yeoman。但我遇到了以下错误。

C:Usersxxxxx>npm install -g yo
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm a
nd is now out of date with respect to npm
C:UsersxxxxxAppDataRoamingnpmyo -> C:UsersxxxxxAppDataRoamingnpm
node_modulesyolibcli.js
> yo@1.7.0 postinstall C:UsersxxxxxAppDataRoamingnpmnode_modulesyo
> yodoctor
'yodoctor' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\xxxxx\AppData
\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g" "yo"
npm ERR! node v4.1.1
npm ERR! npm  v3.3.7
npm ERR! code ELIFECYCLE
npm ERR! yo@1.7.0 postinstall: `yodoctor`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the yo@1.7.0 postinstall script 'yodoctor'.
npm ERR! This is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     yodoctor
npm ERR! You can get their info via:
npm ERR!     npm owner ls yo
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     C:Usersxxxxxnpm-debug.log

然后我尝试"npm install -g yeoman-doctor"来绕过此错误。安装约曼医生后,可以像下面这样找到瑜伽博士。

C:Usersxxxx>yodoctor
Yeoman Doctor
Running sanity checks on your system
√ Global configuration file is valid
√ NODE_PATH matches the npm root
x Node.js version
Your Node.js version is outdated.
Upgrade to the latest version: https://nodejs.org
√ No .bowerrc file in home directory
√ No .yo-rc.json file in home directory
√ npm version
Found potential issues on your machine :(

但不幸的是,当我重新尝试"npm install -g yo"时,问题仍然会发生。

你能告诉我解决方法吗?谢谢。

错误显示您的 npm 已过时。您需要的是先更新npm

尝试 npm -g update

npm -g install npm

我遇到的问题是由我的 .npmrc 文件中的错误前缀值引起的,该文件指向不存在的 Node 版本。 它完全破坏了我在全球范围内安装 npm 包的能力。从我的 .npmrc 文件中删除前缀可以解决此问题。这可能是约门医生可以教他们检测的东西。

要在 .npmrc 中设置前缀值,您必须使用以下命令

set npm_config_prefix=""

相关内容

  • 没有找到相关文章

最新更新