如何阅读npm ENOENT错误

我有2个ENOENT错误。 我知道“ENOENT”的意思是“错误没有ENTrance”,但是在这两个ENOENT中究竟缺less了什么? 这些错误信息是什么意思? 我想破译他们能够debugging的问题。

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 。

读取错误行: 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 

这是conosle.log(new Error().stack)类似于conosle.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) 

一个阅读NPM日志的怪癖:得看看流中的第一个错误。 上游的错误可能导致文件丢失,导致许多错误,如上面报告的错误。

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