如何读取npm ENOENT错误

14

我遇到了2个ENOENT错误。我知道“ENOENT”表示“Error NO ENTrance”,但是这两个ENOENT具体缺少什么呢?这些错误信息是什么意思?我想解密它们以便能够调试问题。

npm ERR! Error: ENOENT, lstat '/home/ubuntu/.npm/iconv-lite/0.2.11/package/encodings/table/gbk.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_e
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /home/ubuntu/.npm/iconv-lite/0.2.11/package/encodings/table/gbk.js
npm ERR! fstream_path /home/ubuntu/.npm/iconv-lite/0.2.11/package/encodings/table/gbk.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)

npm ERR! Error: ENOENT, chmod '/home/ubuntu/app_f/node_modules/grunt/lib/grunt/util.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_f
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /home/ubuntu/app_f/node_modules/grunt/lib/grunt/util.js
npm ERR! fstream_path /home/ubuntu/app_f/node_modules/grunt/lib/grunt/util.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod
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:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm http GET https://registry.npmjs.org/graceful-fs

一个人在 gbk.js 中似乎有一个“lstat”问题,另一个人在 util.js 上有一个“chmod”问题,但是关于命令“node”、“npm”、“install”、“cwd”、“fstream”和 Object.oncomplete 呢?

这里是 writer.js:284。 这里是 writer.js:305

2个回答

8

读取错误行:Error: ENOENT, lstat '/home/ubuntu/.npm/iconv-lite/0.2.11/package/encodings/table/gbk.js'

这意味着当执行像fs.lstat('/home/ubuntu/.npm/iconv-lite/0.2.11/package/encodings/table/gbk.js', ...)这样的操作时,npm收到了ENOENT错误。这意味着文件不存在,但npm希望它在那里。

至于第二个错误,npm正在执行类似于fs.chmod('/home/ubuntu/app_f/node_modules/grunt/lib/grunt/util.js', ...)的操作,然后npm收到了ENOENT错误。

其余的是调试信息。这些都是发生错误时的一些变量/属性:

npm ERR! System Linux 3.2.0-54-virtual --> THis is the system type
npm ERR! command "/home/ubuntu/local/bin/node" "/home/ubuntu/local/bin/npm" "install" --> the command that was issued
npm ERR! cwd /home/ubuntu/app_f --> The current working directory
npm ERR! node -v v0.10.26 --> You should know this one!
npm ERR! npm -v 1.4.3 --> You should know this one!
npm ERR! path /home/ubuntu/app_f/node_modules/grunt/lib/grunt/util.js

以下内容涉及 fstream 模块,它可以精确地指示其具体操作。

npm ERR! fstream_path /home/ubuntu/app_f/node_modules/grunt/lib/grunt/util.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod

以下是错误发生时类似于console.log(new Error().stack)的堆栈跟踪:

npm ERR! fstream_stack /home/ubuntu/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)

3

阅读NPM日志时有一个技巧:必须查看流中的第一个错误。上游的错误可能会导致文件丢失,从而导致出现像您上面报告的许多错误。

尝试转到日志的顶部,然后向下滚动,直到找到最初的第一个错误。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接