node.js - `yo angular` 给出错误 : npm ERR! 代码 ENOENT npm ERR! errno 34(是的,我已经清理了缓存并设置了 .npmignore)

标签 node.js angularjs npm yeoman yeoman-generator

我试图在一个新的项目目录中运行 yo angular,但它在途中的某个地方给了我 ENOENT 错误。是的,我看过 this similar question ,但它的解决方案对我不起作用。

在运行 yo angular 之前,我在空的新项目目录上运行了这些东西:

touch .npmignore
npm cache clear
npm cache clean

但我仍然得到:

npm ERR! Error: ENOENT, lstat '/home/ubuntu/app_c/node_modules/grunt/    internal-tasks/bump.js'
npm ERR! If you need help, you may report this *entire* log, 
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.2.0-54-virtual
npm ERR! command "/home/ubuntu/local/bin/node" "/home/ubuntu/local/bin/  npm" "install"
npm ERR! cwd /home/ubuntu/app_c
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /home/ubuntu/app_c/node_modules/grunt/internal-tasks/bump. js
npm ERR! fstream_path /home/ubuntu/app_c/node_modules/grunt/internal-    tasks/bump.js
npm ERR! fstream_type File 
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /home/ubuntu/local/lib/node_modules/npm/          node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)

我该如何解决?


这里是 history of ALL the commands, in chronological order, that I ran在全新的 Ubuntu Server 12.04.3 上,因此您可以确切地看到导致这一点的原因,以及我在哪里安装了各种软件包。

这个问题链接到一个 npm github issue .

最佳答案

编辑: npm update -g 后跟 npm cache clear 应该适用于大多数情况。但是,在 Mac OS 上首次安装时,您可能需要在首次安装 nodeJS 后导航到 usr/local/lib/node_modules 文件夹并授予“Everyone”读/写权限。在释放这些权限之前,Node 将无法全局安装其他工作流组件。您不想对 npm install 命令执行 sudo,因为那样这些工具在事后将没有 sudo 访问权限来运行。通过右键单击文件夹并转到“获取信息”然后在弹出窗口底部更改权限来更改读/写权限。

我在 Windows 7 机器上遇到了同样的问题。以下是我解决的步骤:

  • 修复 Node 安装
  • 打开高架 cli
  • 运行 npm update -g
  • 运行 npm 缓存清除
  • 运行npm install -g yo
  • 运行 npm 缓存清除
  • 运行 npm install -g generator-angular
  • 运行 npm 缓存清除
  • 创建新目录
  • 运行哟 Angular 测试
  • 运行 npm 缓存清除
  • 运行 grunt serve

我确实遇到了 karma.conf.js 的其他一些问题,其中路径有 \ 而不是 / 用于 bower_components。此外,我注意到可选的 Angular 模块被注入(inject)到我的 app.js 中,尽管没有将它们全部包含在我从 cli 构建的 yo 中。我已经在github上报告了这些问题。

关于node.js - `yo angular` 给出错误 : npm ERR! 代码 ENOENT npm ERR! errno 34(是的,我已经清理了缓存并设置了 .npmignore),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21964874/

相关文章:

javascript - Express.js 查看 "globals"

javascript - ng-repeat 中的总量

javascript - 重新加载 ng-repeat 在删除旧列表之前呈现新列表

c# - 任务运行器资源管理器不工作

node.js - 将 QnA 用户问题和答案添加到 Node JS 中的 Insights 遥测

node.js - 我什么时候返回该查询的数据?

node.js - 在 Node.js 中使用 Winston 在 JSON 对象中输出日志

angularjs - Angular Bootstrap Type Ahead 与 typeahead 语法相关的问题

angularjs - 错误 : Could not find chromedriver while following angularjs official tutorial

node.js - 如何使用 .ebextensions 在 Amazon Elastic Beanstalk 中运行 `npm install`