node.js - 尝试从 npm 安装 Yeoman 时出现 ENOENT 错误

标签 node.js npm yeoman windows-7-x64

我尝试在 cmd 中使用以下命令安装 Yeoman:

npm install --global yo

我得到以下信息:

npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\{userdir}\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--global" "yo"
npm ERR! node v4.4.4
npm ERR! npm  v3.9.0
npm ERR! path C:\{userDIr}\AppData\Roaming\npm\node_modules\yo\lib\cli.js
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod 'C:{userDir}\AppData\Roaming\npm\node_modules\yo\lib\cli.js'
npm ERR! enoent ENOENT: no such file or directory, chmod 'C:\{userDir}\AppData\Roaming\npm\node_modules\yo\lib\cli.js'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     C:\{userDir}\npm-debug.log

已安装以下内容:

  • Node.js v4.4.4
  • npm v2.15.1、v3.9.0(我尝试了这两个版本,我得到了完全相同的输出消息)

我的电脑运行的是 Windows 7 x64。

我尝试过的解决方案:

  1. 我运行

    清除npm缓存

但没有运气。

  • 我卸载并重新安装了node.js,但也没有任何变化。
  • 我还尝试了以下方法:

    • 删除了node_modules文件夹

    • 已删除 C:\\AppData\Roaming\npm-cache 文件夹

    • 在 C:\AppData\Roaming\npm 文件夹的属性中取消选中并应用只读
  • 我在这里阅读了相关问题的所有答案,但没有任何帮助。
  • 在此之前,我用npm成功安装了bower v1.7.9和grunt v1.2.0,执行

    npm install --global yo bower grunt-cli
    

    任何帮助将不胜感激。

    最佳答案

    根据https://github.com/npm/npm/issues/10312https://github.com/yeoman/yo/issues/437问题是yo v1.8.2

    执行

    npm install --global yo@1.8.1
    

    而不是

    npm install --global yo
    

    解决了问题,尽管可能很快就会发布修补程序。

    关于node.js - 尝试从 npm 安装 Yeoman 时出现 ENOENT 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37299413/

    相关文章:

    node.js - 如何在mongodb中实现事务回滚?

    node.js - 发送 SQS 消息超时

    node.js - npm 不支持 Node.js

    node.js - 在 NPM 之后安装 Yarn

    sass - yeoman、SCSS、Bower 服务器、未找到样式/main.css

    node.js - Yeoman 使用 NodeGit 的 Reset,得到常量对象错误

    concatenation - Yeoman & RequireJS 使用动态生成的 HTML 构建?

    node.js - 在 Microsoft BotFramework v4 node.js 中将对话框与 Luis 连接

    node.js - npm 错误!尝试获取时响应超时

    javascript - Zombie.js 不返回完整的 HTML