`yo angular` 给出错误:npm ERR!代码 ENOENT npm ERR!errno 34(是的,我已经清理了缓存并设置了 .npmignore) [英] `yo angular` gives error: npm ERR! code ENOENT npm ERR! errno 34 (yes I have cleaned the cache and set .npmignore)

查看:17
本文介绍了`yo angular` 给出错误:npm ERR!代码 ENOENT npm ERR!errno 34(是的,我已经清理了缓存并设置了 .npmignore)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在一个新的项目目录中运行 yo angular,但它在途中的某个地方给了我 ENOENT 错误.是的,我已经看过这个类似的问题,但它的解决方案没有不适合我.

I tried to run yo angular in a new project directory, but it gave me the ENOENT error somewhere along the way. Yes I have looked at this similar question, but its solution doesn't work for me.

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

I ran these things on the empty new project directory right before running 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)

我该如何解决?

这是我运行的所有命令的历史,按时间顺序一个全新的 Ubuntu Server 12.04.3,因此您可以确切地看到导致这一点的原因,以及我在何处安装了各种软件包.

Here is the history of ALL the commands, in chronological order, that I ran on a brand new Ubuntu Server 12.04.3, so you can see exactly what led up to this point, and where I have installed various packages.

此问题链接到 npm github 问题.

This question is linked to an npm github issue.

推荐答案

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

npm update -g followed by npm cache clear should work for most. However, when first installing on Mac OS you may need to navigate to your usr/local/lib/node_modules folder once nodeJS is first installed and grant read/write permission to "Everyone". Node won't be able to installed additional workflow components globally until those permissions are released. You don't want to sudo the npm install commands, because then those tools won't have sudo access to run after the fact. Read/write permissions are changed by right-clicking the folder and going to "Get info" then changing permissions at bottom of popup.

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

I had this same issue on Windows 7 machine. Here are the steps I took to resolve:

  • 修复节点安装
  • 打开高架 cli
  • 运行 npm update -g
  • 运行 npm 缓存清除
  • 运行 npm install -g yo
  • 运行 npm 缓存清除
  • 运行 npm install -g generator-angular
  • 运行 npm 缓存清除
  • 创建了新目录
  • 运行yo angular test
  • 运行 npm 缓存清除
  • 运行 grunt serve

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

I did run into some other issues with karma.conf.js where the paths had a \ instead of / for bower_components. Also, I noticed the optional angular modules were injected in my app.js despite not including them all in my yo build from the cli. I have reported these issues on github.

这篇关于`yo angular` 给出错误:npm ERR!代码 ENOENT npm ERR!errno 34(是的,我已经清理了缓存并设置了 .npmignore)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆