Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Got ENOENT error when trying to install modules #3664

Closed
srmor opened this Issue · 69 comments
@srmor

When I did npm install on a repo I got the following error:

15684 silly gunzTarPerm extractEntry examples.js
15685 silly gunzTarPerm extractEntry index.js
15686 error Error: ENOENT, open '/var/folders/c5/qdnbg_817vz1tnfvrbzwc6200000gp/T/npm-33836/1373983333743-0.11652350216172636/package/package.json'
15687 error If you need help, you may report this log at:
15687 error     <http://github.com/isaacs/npm/issues>
15687 error or email it to:
15687 error     <npm-@googlegroups.com>
15688 error System Darwin 12.4.0
15689 error command "node" "/usr/local/bin/npm" "install"
15690 error cwd /Users/stephenmorrison/Sites/wiseradar/wiseradar
15691 error node -v v0.10.13
15692 error npm -v 1.3.2
15693 error path /var/folders/c5/qdnbg_817vz1tnfvrbzwc6200000gp/T/npm-33836/1373983333743-0.11652350216172636/package/package.json
15694 error code ENOENT
15695 error errno 34
15696 verbose exit [ 34, true ]

My npm version is 1.3.2 and my node version is 0.10.13. Any ideas?

@KingScooty

I'm getting similar errors when trying to install/update modules:

npm ERR! System Darwin 12.4.0
npm ERR! command "node" "/usr/local/bin/npm" "update" "-g"
npm ERR! cwd /Users/KingScooty
npm ERR! node -v v0.10.13
npm ERR! npm -v 1.3.2
npm ERR! path /var/folders/f5/0qftllzs59n2njz8b89135sc0000gn/T/npm-517/1373986154903-0.9633553579915315/package/lib/flatiron/cli/create.js
npm ERR! code EMFILE
npm ERR! errno 20
npm http 200 https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz
npm http 304 https://registry.npmjs.org/keypress
npm http 200 http://github.com/cowboy/grunt/archive/0ba6d4b529.tar.gz
npm http 200 https://registry.npmjs.org/semver/-/semver-1.0.14.tgz
npm http 304 https://registry.npmjs.org/growl
npm http 304 https://registry.npmjs.org/ansi-color
npm http 304 https://registry.npmjs.org/date-utils
npm http 304 https://registry.npmjs.org/mute-stream
npm ERR! Error: EMFILE, too many open files
npm ERR!     at new Glob (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:105:21)
npm ERR!     at glob (/usr/local/lib/node_modules/npm/node_modules/glob/glob.js:57:11)
npm ERR!     at gypfile (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:133:17)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:118:33
npm ERR!     at Array.forEach (native)
npm ERR!     at extras (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:117:21)
npm ERR!     at parseJson (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:86:17)
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:58:33
npm ERR!     at fs.js:266:14
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Darwin 12.4.0
npm ERR! command "node" "/usr/local/bin/npm" "update" "-g"

/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:266
  log.error("cwd", process.cwd())
                           ^
Error: EMFILE, too many open files
    at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:266:28)
    at process.EventEmitter.emit (events.js:117:20)
    at process._fatalException (node.js:272:26)
@KenanSulayman

@srmor This happens due to missing permissions or unlinked files while npm was working.
@KingScooty See #3259 — this issue will be fixed in the next release.

@srmor

@KenanSulayman Hmm... ok. So any ideas on how to make it work? I tried using sudo npm install and that didn't change anything.

@phillipalexander

+1 I'm having the same issue

@luk-
@Florian79

I have a similar issue after calling npm install (feebs)

node-expat@2.0.0 install C:\development\node\bit-test\node_modules\feebs\node_
modules\xml2json\node_modules\node-expat
node-gyp rebuild

C:\development\node\bit-test\node_modules\feebs\node_modules\xml2json\node_modul
es\node-expat>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\.
...\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: spawn ENOENT
gyp ERR! stack at errnoException (child_process.js:980:11)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:771:
34)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\Program Files\nodejs\node_modules\npm\node_modu
les\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\development\node\bit-test\node_modules\feebs\node_modules\xml2js
on\node_modules\node-expat
gyp ERR! node -v v0.10.13
gyp ERR! node-gyp -v v0.10.2
gyp ERR! not ok
unbuild node-expat@2.0.0
unbuild xml2json@0.3.2
unbuild feebs@0.5.1
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'C:\development\node\bit-tes
t\node_modules\feebs\node_modules\express\node_modules\connect\node_modules\qs\l
ib'
npm ERR! error rolling back feebs@0.5.1 { [Error: ENOTEMPTY, rmdir 'C:\developm
ent\node\bit-test\node_modules\feebs\node_modules\express\node_modules\connect\n
ode_modules\qs\lib']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: 'C:\development\node\bit-test\node_modul
es\feebs\node_modules\express\node_modules\connect\node_modules\qs\lib'
}
npm ERR! weird error 1
npm ERR! Error: ENOENT, lstat 'C:\development\node\bit-test\node_modules\feebs\n
ode_modules\express\node_modules\connect\node_modules\qs\lib\querystring.js'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! npm-@googlegroups.com

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nod
ejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! cwd C:\development\node\bit-test
npm ERR! node -v v0.10.13
npm ERR! npm -v 1.3.2
npm ERR! path C:\development\node\bit-test\node_modules\feebs\node_modules\expre
ss\node_modules\connect\node_modules\qs\lib\querystring.js
npm ERR! fstream_path C:\development\node\bit-test\node_modules\feebs\node_modul
es\express\node_modules\connect\node_modules\qs\lib\querystring.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fst
ream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
unbuild connect@2.7.5
unbuild express@3.1.2
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\development\node\bit-test\npm-debug.log
npm ERR! not ok code 0

@silverwind

I've been getting random ENOENT / ENOTEMPTY all over the place on Windows when trying to install packages on npm 1.3.4. npm kept looping for more than 30 minutes trying to install just 10 packages.

Downgrading node to 0.10.9 and npm to 1.2.24 fixed it for now, so I think this may be an regression somewhere between those versions.

From my experience, these random errors come from opening too many file handles at once on Windows. I remember setting graceful-fs's fs.MAX_OPEN to 256 remedied these errors, at least on for my app, so that might be worth a shot.

@astefas

I am not really a node or npm expert, but I encountered this Errors also. Like 'ERR! code EMFILE'. I resolved this by only updating grunt : 'sudo npm update [-g] grunt'. Then I deleted .npm and after that 'sudo npm update' did not throw any errors. Maybe this helps...

@astefas

actually it was this error:

npm ERR! code EMFILE
npm ERR! errno 20

and i tracked it down to grunt because yeoman is not running correctly on my machine, always failing when executing grunt

@jameswyse

I've been seeing these errors a lot recently too with the latest node/npm on OS X. Removing ~/.npm seems to have fixed everything!

@silverwind

What's the equivalent of ~/.npm on Windows?

@ricardograca

I'm also experiencing the exact same ENOENT error as the OP on Ubuntu 12.04, but only when installing from a github repository.

@domenic
Collaborator

@ricardograca you probably don't have git installed (or if you do it's not in your PATH). If you are on a newer version of npm it should tell you this.

@ricardograca

@domenic That's not it. git is installed and is in the PATH. Not that it matters because the access to the server isn't even being done with git.

@ricardograca

Ok, so the problem was that I was trying to use https://github.com/... instead of git://github.com/... because github no longer generates links for git://, only for https and ssh. Not sure if it's the same problem the OP was having, because in my case there was only a index.js file extracted before the package.json error and that file actually contained html.

@shroomist

rm -rf ~/.npm helped me out, thatks.

@domenic domenic closed this
@okonet

I still have this issue doing npm install on npm 1.3.8, even after doing rm -rf ./~npm

Here is a recent log I've got:

npm ERR! weird error 1
npm ERR! Error: ENOENT, open '/Users/jetbrains/buildAgent/temp/buildTmp/npm-64997-D8rXPGF8/1378204469803-0.7390178274363279/package/package.json'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/jetbrains/buildAgent/work/78bd345f717dbab0/webui
npm ERR! node -v v0.10.17
npm ERR! npm -v 1.3.8
npm ERR! path /Users/jetbrains/buildAgent/temp/buildTmp/npm-64997-D8rXPGF8/1378204469803-0.7390178274363279/package/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! Error: ENOENT, lstat '/Users/jetbrains/buildAgent/temp/buildTmp/npm-64997-D8rXPGF8/1378204470644-0.09840521146543324/package/test/eyes-test.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

Any workaround?

@ricardograca

@okonet Have you looked at the files under /Users/jetbrains/buildAgent/temp/buildTmp/npm-64997-D8rXPGF8/1378204470644-0.09840521146543324? If you analyze them you'll probably find out what the actual problem is.

@mpj

"rm -rf ~/.npm" did it for me.

@Zugwalt

On Windows 7, I did the following to overcome this. Pretty sure that not all the steps are needed but I wasn't patient enough to try one at a time :-P

  • deleted the node_modules folder
  • deleted C:\<Username>\AppData\Roaming\npm-cache folder
  • unchecked and applied Read-only in the properties for C:\<username>\AppData\Roaming\npm folder

Note AppData is a hidden folder, so you may need to enable viewing of hidden files and folders to access it.

@machunter

i ran into a similar problem, npm cache clean solved it.

@TJKoury

Windows 8 x64, can confirm npm cache clean worked for me.

@jishi jishi referenced this issue in jishi/node-sonos-web-controller
Closed

Couldn't read dependencies #2

@jrode

Yup, Windows 7 x64, npm cache clean solved it

@virtualandy virtualandy referenced this issue in tombatossals/angular-leaflet-directive
Open

featureGroups or some other way to fit groups of markers on the map #215

@Vahanerevan

npm cache clean solved.

@calbertts

I got this error installing devtools-terminal, I've resolved running the terminal like Admin on Windows 8.

@reggi

yes npm cache clean :+1:

@mpj

If you are using a private npm repository, this error can also arise if you accidentally point to the public npm repo.

@donald-s

I know this issue is closed, but I was just having trouble with the same error. I looked for a .npm directory in my home directory (I'm running Windows), but all I could find was an .node-gyp directory. I deleted it and everything worked fine. Not sure what changed.

@ajilmohan

Hi
I'm getting the same error on npm install command.

error is given below

npm ERR! Error: UNKNOWN, open 'C:\Users\ajilam\AppData\Roaming\npm-cache\configstore\0.2.3\package\package.json'
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 Windows_NT 6.1.7601
npm ERR! command "C:\Program Files (x86)\nodejs\\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! cwd D:\angularjs-workarea\angular-phonecat
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! path C:\Users\ajilam\AppData\Roaming\npm-cache\configstore\0.2.3\package\package.json
npm ERR! code UNKNOWN

I verified 'package.json' is avaiable on the specified path. Its available there.
I tried npm cache clean also , its not working for me ..
Anything i missed ?

@nicholasstephan

Ditto. I'm getting this error too.

@karthikkornalies

I tried "npm cache clean" But still getting the same errors. Anyone knew different resolution?.

@MortalCatalyst

Error still on Ubuntu 14.04 64 Bit.

rm -rf ~/.npm didn't resolve it.

So I removed it
sudo apt-get remove npm

re iinstall it.
sudo apt-get install npm

Clean cache didn't resolve
sayth:~$ npm cache clean

Error still existed, made npm install itself.

sayth:~$ npm install npm
npm http GET https://registry.npmjs.org/npm
npm http 200 https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/npm/-/npm-1.4.15.tgz
npm http 200 https://registry.npmjs.org/npm/-/npm-1.4.15.tgz
npm WARN package.json github-url-from-git@1.1.1 No repository field.
npm@1.4.15 node_modules/npm

Still existed. Unsure how to resolve error.

@Pentiado Pentiado referenced this issue in Pentiado/catch-me
Closed

Installation issues #1

@thiagof

In my case (ubuntu 14) was missing node executable which is found in the nodejs-legacy package.

@igorescobar

npm cache clean did it

@gordlea

I was getting this until I added C:\Users<user>\AppData\Roaming\npm-cache as an excluded file location to my antivirus.

I'm running windows 7.

@Swoot1

Thank you @gordlea. That worked for me too and I'm also running Windows 7.

@haruitk

cache clean! on windows 7

@kdbanman

I'm getting a similar kind of error on OS X 10.8.5, running node 0.10.11 and npm 1.2.30. Trying to globally install bower with this command:

sudo npm install -g bower

Relevant npm-debug.log section:

2874 error Error: ENOENT, chown '/usr/local/share/npm/lib/node_modules/bower/node_modules/semver/semver.browser.js'
2875 error If you need help, you may report this log at:
2875 error     <http://github.com/isaacs/npm/issues>
2875 error or email it to:
2875 error     <npm-@googlegroups.com>
2876 error System Darwin 12.5.0
2877 error command "/usr/local/Cellar/node/0.10.11/bin/node" "/usr/local/bin/npm" "install" "-g" "bower"
2878 error cwd /Users/kdbanman
2879 error node -v v0.10.11
2880 error npm -v 1.2.30
2881 error path /usr/local/share/npm/lib/node_modules/bower/node_modules/semver/semver.browser.js
2882 error fstream_path /usr/local/share/npm/lib/node_modules/bower/node_modules/semver/semver.browser.js
2883 error fstream_type File
2884 error fstream_class FileWriter
2885 error fstream_finish_call chown
2886 error code ENOENT
2887 error errno 34
2888 error fstream_stack /usr/local/Cellar/node/0.10.11/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
2888 error fstream_stack /usr/local/Cellar/node/0.10.11/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:265:7
2888 error fstream_stack Object.oncomplete (fs.js:107:15)
@dhyegofernando

I have been trying throughout many ways resolve that, but i can't. I think, it's a problem with windows' symlinks. Someone help meee please.

My npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'c:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'link' ]
2 info using npm@1.4.14
3 info using node@v0.10.29
4 verbose linkPkg k:\generators
5 verbose link build target C:\Users\Programacao02\AppData\Roaming\npm\node_modules\yeoman-generator
6 verbose install where,what [ 'k:\\generators', [] ]
7 verbose readDependencies using package.json deps
8 verbose install where, deps [ 'k:\\generators',
8 verbose install   [ 'cheerio',
8 verbose install     'request',
8 verbose install     'rimraf',
8 verbose install     'tar',
8 verbose install     'diff',
8 verbose install     'mime',
8 verbose install     'underscore.string',
8 verbose install     'lodash',
8 verbose install     'mkdirp',
8 verbose install     'read',
8 verbose install     'glob',
8 verbose install     'nopt',
8 verbose install     'cli-table',
8 verbose install     'debug',
8 verbose install     'bower',
8 verbose install     'mocha' ] ]
9 info preinstall yeoman-generator@0.9.5
10 warn package.json cli-table@0.2.0 No repository field.
11 warn package.json bower@0.7.1 No repository field.
12 verbose readDependencies using package.json deps
13 verbose already installed skipping tar@~0.1.16 k:\generators
14 verbose already installed skipping diff@~1.0.4 k:\generators
15 verbose already installed skipping mime@~1.2.9 k:\generators
16 verbose already installed skipping underscore.string@~2.3.1 k:\generators
17 verbose already installed skipping lodash@~1.0.0-rc.3 k:\generators
18 verbose already installed skipping mkdirp@~0.3.4 k:\generators
19 verbose already installed skipping read@~1.0.4 k:\generators
20 verbose already installed skipping glob@~3.1.17 k:\generators
21 verbose already installed skipping nopt@~2.1.1 k:\generators
22 verbose already installed skipping cli-table@~0.2.0 k:\generators
23 verbose already installed skipping debug@~0.7.0 k:\generators
24 verbose already installed skipping bower@~0.7.0 k:\generators
25 verbose already installed skipping mocha@~1.8.1 k:\generators
26 verbose already installed skipping cheerio@~0.10.6 k:\generators
27 verbose already installed skipping request@~2.12.0 k:\generators
28 verbose already installed skipping rimraf@~2.1.2 k:\generators
29 silly resolved []
30 info build k:\generators
31 verbose linkStuff [ false, false, false, 'k:\\' ]
32 info linkStuff yeoman-generator@0.9.5
33 verbose linkBins yeoman-generator@0.9.5
34 verbose linkMans yeoman-generator@0.9.5
35 verbose rebuildBundles yeoman-generator@0.9.5
36 verbose rebuildBundles [ '.bin',
36 verbose rebuildBundles   'bower',
36 verbose rebuildBundles   'cheerio',
36 verbose rebuildBundles   'cli-table',
36 verbose rebuildBundles   'debug',
36 verbose rebuildBundles   'diff',
36 verbose rebuildBundles   'glob',
36 verbose rebuildBundles   'lodash',
36 verbose rebuildBundles   'mime',
36 verbose rebuildBundles   'mkdirp',
36 verbose rebuildBundles   'mocha',
36 verbose rebuildBundles   'nopt',
36 verbose rebuildBundles   'read',
36 verbose rebuildBundles   'request',
36 verbose rebuildBundles   'rimraf',
36 verbose rebuildBundles   'tar',
36 verbose rebuildBundles   'underscore.string' ]
37 info install yeoman-generator@0.9.5
38 info postinstall yeoman-generator@0.9.5
39 info prepublish yeoman-generator@0.9.5
40 info build C:\Users\Programacao02\AppData\Roaming\npm\node_modules\yeoman-generator
41 error Error: ENOENT, open 'C:\Users\Programacao02\AppData\Roaming\npm\node_modules\yeoman-generator\package.json'
42 error If you need help, you may report this *entire* log,
42 error including the npm and node versions, at:
42 error     <http://github.com/npm/npm/issues>
43 error System Windows_NT 6.1.7601
44 error command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "link"
45 error cwd k:\generators
46 error node -v v0.10.29
47 error npm -v 1.4.14
48 error path C:\Users\Programacao02\AppData\Roaming\npm\node_modules\yeoman-generator\package.json
49 error code ENOENT
50 error errno 34
51 verbose exit [ 34, true ]
@dhyegofernando

Solved

Hey guys, i've just fixed my problem. Everything that you have to do is run the command bash as Administrator.

(Windows 7 x64)

@bgaborg

This is not a solution afaik. This is an

UGLY HACK

@dhyegofernando

I don't know how symlinks work so well, but i think you need administrator's permissions to create it.

@jasonshark

getting the ENOENT error any time I try to use npm

$ npm cache clean
Error: ENOENT, open '/home/jasonshark/null'
$ npm
Error: ENOENT, open '/home/jasonshark/null'
$ npm -v
1.4.21
$ node
> 

$ rm -rf ~/.npm did not solve the issue. I'm runnin ubuntu 12.04. opened #5861. This seems like a related thread tho

@indira69

De la respuesta de l os que me antecedieron lei lo sigte:
On Windows 7, I did the following to overcome this. Pretty sure that not all the steps are needed but I wasn't patient enough to try one at a time :-P

deleted the node_modules folder
deleted C:<Username>\AppData\Roaming\npm-cache folder
unchecked and applied Read-only in the properties for C:<username>\AppData\Roaming\npm folder
Note AppData is a hidden folder, so you may need to enable viewing of hidden files and folders to access it.

Luego fui a ver la carpeta:
C:<Username>\AppData\Roaming\npm
pero en mi windows no existia la carpeta, luego la cree y > npm install

funciono
asi que gracias Zugwalt

@laurelnaiad laurelnaiad referenced this issue in marklogic/marklogic-samplestack
Closed

osx: npm install: npm locks up ~/.npm directory #130

@jamescrowley

In my case, I hit this after a fresh install of Node on Windows 8. I just went and created the C:\username\AppData\Roaming\npm folder, as it wasn't present - this solved it for me.

@LongLiveCHIEF

I'm getting this after a fresh install of node on Ubuntu-Gnome 14. I configured node with the prefix of $HOME/local, and node seems to run fine. I used git clone for both sources, but used ./configure after checking out a local branch of the node repo from the latest release branch (v0.11.9). Each time I try to install I consistently get the error -i used with no filenames on the command line, reading from STDIN

@patdavid

@jamescrowley had a solution that worked for me. Fresh, brand new installation on Win7 64bit using node-v0.10.30-x64.msi.

npm didn't work, errored with: Error: ENOENT, stat 'C:\Users\USERNAME\AppData\Roaming\npm'

The reason was that this folder didn't exist. I manually created the npm folder in that location, and now things appear to be working.

@LongLiveCHIEF
@othiym23
Owner

I'm pretty sure this is an issue in the Node installer for Windows. The whole reason that npm uses $USERNAME\AppData\Roaming\npm is that non-administrative roles can write to the latter but not the application directory where Node (and npm) are originally installed. Since creating that directory if it doesn't exist does require Administrator privileges, npm -g install <whatever> won't / can't work. I'll open an issue on Node for this.

@buechling

I had the following error on fresh installation of node.js under Windows Server 2012 R2:

Microsoft Windows Version 6.3.9600 2013 Microsoft Corporation. Alle Rechte vorbehalten.

C:\Windows\system32>npm
Error: ENOENT, stat 'C:\Users\Administrator\AppData\Roaming\npm'

The Solution is to create the given folder manually for every user

@ErisDS ErisDS referenced this issue in TryGhost/Ghost
Closed

Error: ENOENT, stat #3752

@LongLiveCHIEF

Yeah... no... If you are a windows user, you get this error for a totally valid reason. The solution is not "to create the given folder manually for every user". First, you have to understand what's happening, and on windows, if you aren't using Powershell or whatever shell you're using as admin, node won't have permissions to create the root folder for npm or node_modules.

Manually creating the folder is not a fix. You will start to get EACCESS errors when installing some of your modules, if you resorted to manually creating the folder without realizing the underlying cause.

Now... on Linux/Unix systems... it's a completely different issue, as the active user should have access to the parent directories these folders are created in, and in my cases, the error persists even when I compile node and then install npm (node using prefix $HOME/local), and then appending that to my $PATH.

Windows users... run the install as admin, or run the install to a user owned directory. If you are compiling from source then use the --prefix flag and set it to something like:

./configure --prefix=C:\Users\$USER\local

If you still get the same error, and you aren't running as admin, then you'll know you are experiencing the same issue reporting here.

@alundiak

I've just installed 10.0.30 v on Windows, and I wanted "npm init" but fail.
So fix of this issue was the following:

npm install -g grunt-cli

So that NodeJS/npm created folder (which is odd, why it couldn't' create during Node.JS)
And then I could run "npm init" or whatever npm command.

PS. my Windows user is standard user, not administrator.

@LucciSMo

Al parecer en el ultimo instalador se les paso poner que creara la carpeta
Luego fui a ver la carpeta:
C:\AppData\Roaming\npm
pero en mi windows no existia la carpeta, luego la cree braviado como los cholos
y ya funcionan todos los comandos de instalacion

@murrah

Win 7 professional. I was logged in as Administrator and still got the problem. From @LongLiveCHIEF I uninstalled node from c:\Program files\nodejs and reinstalled in C:\nodejs. All worked perfectly after that, :-)

@LongLiveCHIEF

@murrah that's basically the same as prefixing, but on Windows, creating a directory at the root level like that works differently. In your case, it's not a bad idea (as long as you're ok with cluttering your highest level directory)... just make sure you add the node and npm bin folders to your path. Otherwise when you try to install something like phantomJS or anything else that doesn't run on node, but is called by node... you'll run into problems.

On a sidenote... I love how all these Windows users think they have the same issue, and then subsequently think they have solved the issue, when all along if they would do things the right way in the first place, they'd not even HAVE an issue.

This thread was started by a Mac user (if you don't know how I know that, then you really shouldn't be saying "this is how I fixed it"), and only applies to linux/unix systems for the cause of this instance of the error.

There are a myriad number of reason you'll get an ENOENT error, but all of you Windows people are getting it for a completely different reason.... either installing as a non-admin to protected directories, or installing as an admin and subsequently trying to run installs as a regular user.

@jakblak

@jamescrowley solution worked for me also on windows 8
In my case, I hit this after a fresh install of Node on Windows 8. I just went and created the C:\username\AppData\Roaming\npm folder, as it wasn't present

@MathRobin

Getting the error too.
Versions :
$ node -v
v0.10.31
$ npm -v
1.4.23
I'm on last debian wheezy up-to-date.

Whatever I'm trying to do (with or without sudo) :
$ sudo npm cache clean
Error: ENOENT, open '[...mypath...]/src/libjs/null'
$ sudo npm install grunt-concurrent
Error: ENOENT, open '[...mypath...]/src/libjs/null'
$ sudo npm install grunt-concurrent --save-dev
Error: ENOENT, open '[...mypath...]/src/libjs/null'

Same problem even if i done this before :
rm -rf ~/.npm

@guyfawkes5

@jamescrowley has it, creating the directory C:\Users{yourUsername}\AppData\npm if it doesn't already exist solves this for Windows 8.

@monya001

to solve on Win7 I created "C:\Users{yourUsername}\AppData\Roaming\npm" folder using command line "mkdir C:\Users{yourUsername}\AppData\Roaming\npm"

@LongLiveCHIEF
@ramnathsagar

On windows machine, sometimes this might happen, when npm folder is not present under AppData\Roaming. Fix it by creating a dir called npm over here

@Yahkob Yahkob referenced this issue in JavascriptBattle/javascript-battle-testing-website
Merged

Feature(HERO) Add randomly selected standard AI to bots #26

@antonioribeiro

What I have:

Windows 8 on a SSD drive, shared with
Ubuntu Linux 14.04 using cifs (samba) which map a folder on SSD to /var/www/
NodeJS v0.10.32
npm 1.4.28

This Windows desktop is just for text editing (PHPStorm can be very slow on network), everything else is done on Linux, package install (Composer, npm, gulp, etc.) and also the webserver (PHP + NGINX).

But as many others here npm install AND sudo npm install both gives me a bunch of

npm ERR! System Linux 3.13.0-32-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd /var/www/app.dev
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path /var/www/app.dev/node_modules/laravel-elixir/node_modules/gulp-less/node_modules/less/node_modules/request/node_modules/node-uuid/.npmignore
npm ERR! code EIO
npm ERR! errno 55
npm ERR! Error: EIO, open '/var/www/app.dev/node_modules/laravel-elixir/node_modules/gulp-less/node_modules/less/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json'
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>

But why is it able to install some of the packages/files?

I tried to

  • Delete the full node_modules folder
  • Delete ./~npm folder
  • Run npm cache clean

The folder is writable, since I have other software like Composer and NGINX being able to write to it, it's just npm which is having trouble and only with some files, because it was able to install half of them, around 60MB of 116MB.

Everything installs fine doing

$ mkdir /tmp/node
$ cp package.json /tmp/node/
$ cd /tmp/node
$ npm install

But while moving that folder to /var/www, I got those errors:

mv: cannot create symbolic link ‘./node_modules/laravel-elixir/node_modules/gulp-phpunit/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi’: Operation not supported

And I understood that some of the problems (not all of them) are not related to file creation, but symbolic links, which aren't being correctly translated. Maybe because:

The default security settings in Windows Vista/Windows 7 disallow non-elevated administrators and all non-administrators from creating symbolic links. This behavior can be changed running "secpol.msc" the Local Security Policy management console (under: Security Settings\Local Policies\User Rights Assignment\Create symbolic links). It can be worked around by starting cmd.exe with Run as administrator option or the runas command.

I disabled that limitation on Windows, but still the links are not being created. So, this might also not be the source of the problem.

@othiym23
Owner

@antonioribeiro, see #6438 (comment) – it seems that you've run into the same issue. It's a weird one!

@antonioribeiro

Super weird. As you noticed I'm in a Linux command line prompt and I cannot run chcp directly, but I tried to mount it:

sudo mount -t cifs //172.17.0.100/\!Development /var/www -o file_mode=0664,dir_mode=0775,_netdev,gid=33,uid=1000,credentials=/home/antoniocarlos/cifs-credentials.txt,iocharset=<CODEPAGE>

Using some different codepages:

utf8
cp850
cp860
cp1250

And always got the very same error.

Usually those problems are related to character translation from one table to another, but there are no special chars in those files, and I'm able to manually touch the very same file npm is erroring on:

touch /var/www/app.dev/node_modules/laravel-elixir/node_modules/gulp-concat/LICENSE
@othiym23
Owner

@antonioribeiro If you want to continue this discussion, you should probably open a new issue, because there are 50 participants on this issue, the original bug is unrelated to what you're seeing, and thus we're spamming a whole bunch of people with something unrelated to them. That said, all it needs is one character that is out-of-codepage to cause EIO, which is otherwise a very rare error in Node.

@rrozanka

Just got the same issue on Ubuntu 14.04. I fixed it by installing this package:

sudo apt-get install nodejs-legacy

@arviman

Had this issue on Win 7 x64. It appeared that installing node did not create the C:\users<username>\appdata\roaming\npm and c:\users<username>\appdata\roaming\npm-cache folder. Creating them manually fixed it.

@buechling

still error on Ubuntu 14 ..

gyp ERR! System Linux 3.16.0-24-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "configure" "build"
gyp ERR! cwd /home/coin/node-bignum
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok

npm ERR! bignum@0.9.0 install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bignum@0.9.0 install script.
npm ERR! This is most likely a problem with the bignum package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls bignum
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.16.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/coin/node-bignum
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

thanks rrozanka , this helps:
apt-get install nodejs-legacy

@KenanY

@buechling Your issue is unrelated to the thread you've commented on. Regardless, your issue is not the fault of npm but the consequence of the Debian developers' decision to rename the Node.js binary from node to nodejs. Some modules on npm expect the binary to be called node. The nodejs-legacy apt package symlinks a node binary to nodejs.

@othiym23 othiym23 locked and limited conversation to collaborators
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Something went wrong with that request. Please try again.