Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read npm ENOENT errors

Tags:

linux

node.js

npm

I've got 2 ENOENT errors. I know "ENOENT" means "Error NO ENTrance", but what exactly is missing in these two ENOENTs? What do these error messages mean? I would like to decipher them to be able to debug the problems.

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)

and

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

One seems to have an "lstat" problem on gbk.js, the other an "chmod" problem on util.js, but what about the commands "node", "npm" and "install", "cwd", "fstream", and Object.oncomplete?

Here is writer.js:284. Here is writer.js:305.

like image 426
randwa1k Avatar asked Feb 25 '14 15:02

randwa1k


People also ask

What does error code Enoent mean?

It's an abbreviation of Error NO ENTry (or Error NO ENTity), and can actually be used for more than files/directories. It's abbreviated because C compilers at the dawn of time didn't support more than 8 characters in symbols. Follow this answer to receive notifications. edited Jun 4, 2019 at 14:30. community wiki.

How do I fix npm err Enoent Enoent No such file or directory?

To resolve the ENOENT warning message, you need to add a package. json file in the directory where you run the npm install command. And then run your npm install command again. This time, the warning message should not appear.


1 Answers

Reading the error line: Error: ENOENT, lstat '/home/ubuntu/.npm/iconv-lite/0.2.11/package/encodings/table/gbk.js'

It means that when doing something like fs.lstat('/home/ubuntu/.npm/iconv-lite/0.2.11/package/encodings/table/gbk.js', ...), npm received ENOENT error. Which means the file was missing, but npm expected it to be there.

And for the second one, npm was doing something like fs.chmod('/home/ubuntu/app_f/node_modules/grunt/lib/grunt/util.js', ...) and npm received ENOENT error.

The rest are debug information. These all are some variables/properties at the time error happened:

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

These are about fstream module. It Indicates what was it doing exactly.

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

This is the stacktrace(something like output of conosle.log(new Error().stack)) when the error happened:

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)
like image 148
Farid Nouri Neshat Avatar answered Oct 18 '22 14:10

Farid Nouri Neshat