Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

ENOENT during npm install #9633

Closed
aredridel opened this issue Sep 17, 2015 · 107 comments · Fixed by Automattic/node-canvas#677
Closed

ENOENT during npm install #9633

aredridel opened this issue Sep 17, 2015 · 107 comments · Fixed by Automattic/node-canvas#677

Comments

@aredridel
Copy link
Contributor

:; npm i
- wreck@5.6.1 node_modules/hapi/node_modules/h2o2/node_modules/wreck
- h2o2@4.0.1 node_modules/hapi/node_modules/h2o2
- joi@5.1.0 node_modules/hapi/node_modules/heavy/node_modules/joi
- inert@2.1.6 node_modules/hapi/node_modules/inert
- vision@2.0.1 node_modules/hapi/node_modules/vision
- wreck@6.0.0 node_modules/hapi/node_modules/wreck
lru-cache@2.6.5 node_modules/hapi/node_modules/inert/node_modules/lru-cache -> node_modules/inert/node_modules/lru-cache
newww@2.1.0 /Users/aredridel/Projects/npm/newww
├─┬ @soldair/marky-markdown@6.0.0
│ ├─┬ @soldair/highlights@1.3.1
│ │ ├─┬ @soldair/first-mate@3.1.2
│ │ │ └─┬ @soldair/oniguruma@4.2.4
│ │ │   └── nan@1.6.1
│ │ └── optimist@0.6.1
│ ├─┬ cheerio@0.18.0
│ │ └─┬ htmlparser2@3.8.3
│ │   ├── domhandler@2.3.0
│ │   ├── domutils@1.5.1
│ │   └── entities@1.0.0
│ └── lodash@2.4.2
├── ammo@1.0.1  extraneous
├── boom@2.8.0
├─┬ cheerio@0.17.0
│ ├─┬ htmlparser2@3.7.3
│ │ ├── domutils@1.5.1
│ │ └── entities@1.0.0
│ └── lodash@2.4.2
├─┬ favicons@3.1.3
│ └─┬ merge-defaults@0.2.1
│   └── lodash@2.4.2
├─┬ grunt@0.4.5
│ ├─┬ findup-sync@0.1.3
│ │ └── lodash@2.4.2
│ └─┬ grunt-legacy-log@0.1.2
│   ├─┬ grunt-legacy-log-utils@0.1.1
│   │ └── lodash@2.4.2
│   └── lodash@2.4.2
├─┬ gulp-jshint@1.11.2
│ ├─┬ jshint@2.8.0
│ │ └─┬ htmlparser2@3.8.3
│ │   ├── domhandler@2.3.0
│ │   ├── domutils@1.5.1
│ │   └── entities@1.0.0
│ └─┬ rcloader@0.1.2
│   ├── lodash@2.4.2
│   └─┬ rcfinder@0.1.8
│     └── lodash@2.4.2
├─┬ gulp-stylus@1.3.7
│ ├─┬ accord@0.12.0
│ │ └── lodash@2.4.2
│ └── lodash@2.4.2
├─┬ hapi@9.3.1
│ ├── accept@1.1.0
│ ├── ammo@1.0.1
│ ├── boom@2.8.0
│ ├── call@2.0.2
│ ├── catbox@6.0.0
│ ├── catbox-memory@1.1.2
│ ├── iron@2.1.3
│ ├─┬ joi@6.6.1
│ │ └── moment@2.10.6
│ ├─┬ mimos@2.0.2
│ │ └── mime-db@1.18.0
│ ├── shot@1.6.0
│ └─┬ subtext@2.0.0
│   ├── content@1.0.2
│   └── wreck@6.1.0
├─┬ lab@5.17.0
│ ├─┬ eslint@1.4.3
│ │ └─┬ handlebars@4.0.2
│ │   └── optimist@0.6.1
│ └─┬ handlebars@4.0.2
│   └── optimist@0.6.1
├── moment@2.10.6
├─┬ mustache-mailer@2.1.2
│ └─┬ handlebars@3.0.3
│   └── optimist@0.6.1
├── npm-email-templates@1.9.2
├─┬ npm-explicit-installs@2.0.0
│ └─┬ pkgs@1.2.0
│   └── lodash@2.4.2
├─┬ request@2.62.0
│ └─┬ mime-types@2.1.6
│   └── mime-db@1.18.0
├─┬ sanitize-html@1.10.0
│ └─┬ htmlparser2@3.8.3
│   ├── domhandler@2.3.0
│   ├── domutils@1.5.1
│   └── entities@1.0.0
└─┬ vision@3.0.0
  └── joi@6.7.1

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/lib/node_modules/iojs-bin/node_modules/iojs-darwin-x64/iojs-v3.3.0-darwin-x64/bin/iojs" "/usr/local/bin/npm" "i"
npm ERR! node v3.3.0
npm ERR! npm  v3.3.3
npm ERR! path /Users/aredridel/Projects/npm/newww/node_modules/hapi/node_modules/inert/node_modules/lru-cache
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/Users/aredridel/Projects/npm/newww/node_modules/hapi/node_modules/inert/node_modules/lru-cache' -> '/Users/aredridel/Projects/npm/newww/node_modules/inert/node_modules/lru-cache'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/aredridel/Projects/npm/newww/npm-debug.log

Debug log at https://gist.github.com/aredridel/c4a223407ee1f7f30aec

@dvlsg
Copy link

dvlsg commented Sep 17, 2015

I am also having this issue, so far with gulp-eslint@1.0.0 and del@2.0.2 with npm v3.3.3 (and node v4.0.0). I can verify that the destination folders for the attempted rename/move do not exist (for gulp-eslint it was node_modules/eslint/node_modules/object-assign, and for del it was node_modules/globby/node_modules/glob).

A workaround (which seems to be working so far) was to install the packages for the missing destinations manually -> so in my case, eslint and globby before installing gulp-eslint and del.

@rafaelmagu
Copy link

Seeing the same issue on 3.3.3 with Node 0.12.7, on multiple different modules:

npm ERR! Linux 3.13.0-63-generic
npm ERR! argv "node" "/usr/bin/npm" "install" "--tmp" "/tmp/npm-temp-wrapper-EY6s04"
npm ERR! node v0.12.7
npm ERR! npm  v3.3.3
npm ERR! path /mnt/workspace/test/node_modules/bower/node_modules/inquirer/node_modules/readline2/node_modules/strip-ansi/cli.js
npm ERR! code ENOENT
npm ERR! errno -2

npm ERR! enoent ENOENT, chmod '/mnt/workspace/test/node_modules/bower/node_modules/inquirer/node_modules/readline2/node_modules/strip-ansi/cli.js'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /mnt/workspace/test/npm-debug.log

Sometimes the operation is different (rename instead of chmod):

npm ERR! enoent ENOENT, rename '/mnt/workspace/test/node_modules/bower-config/node_modules/osenv'

Modules: nopt, osenv (none are direct dependencies of my project; they're dependencies of dependencies, etc)

@dvlsg how are you doing the ordering of packages to be installed? Individual npm install lines before your main packages install?

@dvlsg
Copy link

dvlsg commented Sep 21, 2015

Yeah, I would check which folders didn't exist on the failed renames, and npm install those first. Usually saving them to the package too. It seems like the errors don't occur when you have everything download in one shot, either.

@rafaelmagu
Copy link

I'm confused by this sentence:

Yeah, I would check which folders didn't exist on the failed renames, and npm install those first.

In the following case:

npm ERR! enoent ENOENT, rename '/mnt/workspace/test/node_modules/pump/node_modules/end-of-stream/node_modules/once'

How do you npm install end-of-stream inside of pump? Having to go into each of the dependencies' modules and doing an npm install seems overkill, and surely indicates there's a problem with the npm resolver, right?

@dvlsg
Copy link

dvlsg commented Sep 21, 2015

I didn't actually install them into the embedded packages - I installed
them into the base npm_modules, and npm picked them up from there.

It sort of dirtied up my own package.json, but it made everything work for
me.
On Sep 20, 2015 7:14 PM, "Rafael Fonseca" notifications@github.com wrote:

I'm confused by this sentence:

Yeah, I would check which folders didn't exist on the failed renames, and npm
install those first.

In the following case:

npm ERR! enoent ENOENT, rename '/mnt/workspace/test/node_modules/pump/node_modules/end-of-stream/node_modules/once'

How do you npm install end-of-stream inside of pump? Having to go into
each of the dependencies' modules and doing an npm install seems
overkill, and surely indicates there's a problem with the npm resolver,
right?


Reply to this email directly or view it on GitHub
#9633 (comment).

@rafaelmagu
Copy link

Ah, cool. Will try that.

@othiym23 othiym23 added this to the 3.x milestone Sep 21, 2015
@othiym23
Copy link
Contributor

I've run into this a few times as well, and it mostly seems to happen when running installs or updates on pre-existing node trees. Doing a clean install has fixed it every time thus far (or, in the case of a global package, running npm -g uninstall <package> ; npm -g install <package>). This should be a high-priority fix, because it does cause the install to crash.

@rafaelmagu
Copy link

In my case, the problem went away with a complete removal of node_modules/ (rm -rf-style).

@dvlsg
Copy link

dvlsg commented Sep 21, 2015

Interesting. That didn't work for me -- it was the first thing I tried. Unless you mean the global node_modules folder? I didn't try that. I wonder if I had something floating around my global modules which was getting in the way.

@rafaelmagu
Copy link

@dvlsg I'm installing with --tmp pointing to a local temporary folder, avoiding -g as much as possible.

@LoicMahieu
Copy link

I run into this when I do npm update on node_modules installed by npm@2

@giyyapan
Copy link

Same issue on 3.3.3 with Node 4.1.1
Problem went away after npm uninstall {module}.

@lencioni
Copy link

lencioni commented Nov 9, 2015

Not sure if this is helpful or not, but here's a debug log from npm 3.4.0 today where I ran into this: https://gist.github.com/lencioni/8b1251b33b4d7b80fd4d

@pascalberger
Copy link

I also experience an ENOENT error with a Node.js 5.0.0 installation on Windows. npm version installed with Node.Js 5.0.0 is 3.3.6. It might be that the error is fixed in a newer npm version, but unfortunately I also get the error when trying to update npm npm install -g npm:latest. Is there a way to update npm in this case to see if the error was fixed in a newer version.

Edit: It seems like on some machines npm install -g npm:latest works once. But after npm uninstall -g npm any global npm installations as well as npm install -g npm:latest again fails with an ENOENT error. Even completely removal of npm folder in the roaming directory doesn't help in this case.

@gr2m
Copy link

gr2m commented Nov 10, 2015

I think we run into the same issue with node@4.4.2 & npm@3.3.12:
https://gist.github.com/anonymous/3a4ce83407c68a3d85d7

Same result with node@4.4.1 & npm@3.3.10.
It works with npm@2.14.10

@missuor
Copy link

missuor commented Mar 30, 2017

when i add a package.json into git repository and run npm install, it works.

Error: [@https://github.com/xxxxxxx.git] ENOENT: no such file or directory, chmod 'xxx\node_modules\.tmp\1922952f-06d2-4061-a302-27af587ec0ba\package.json'

@mark007
Copy link

mark007 commented Jun 14, 2017

After moving from the nodejs alpine image 6.10.3 to 8.1.0 this happens me too

npm ERR! enoent ENOENT: no such file or directory, rename '/opt/mean.js/node_modules/pm2/node_modules/fsevents/node_modules/glob' -> '/opt/mean.js/node_modules/wiredep/node_modules/glob'

No other changes were made to my package.json or Dockerfile. In my case I'm doing an npm install with NODE_ENV set to production, and later in my docker build, I do RUN npm install --only=dev so that I can temporarily install the dev / build dependencies which are later removed.

Its the npm install --only=dev thats throwing up the issue.

@dmartinesmedseek
Copy link

This happened to me when package-lock.json got out of sync, due to manually doing stuff to node_modules directory.

@Schnodderbalken
Copy link

I can confirm the comment from @felix-d (may 2016). I wonder how this can still be an issue over a year later...

@jackbrown
Copy link

For anyone that arrived at this issue from google, I was seeing the following error:

npm ERR! enoent ENOENT: no such file or directory, rename '/Users/jackbrown/git/myproject/node_modules/.staging/node-pre-gyp' -> '/Users/jackbrown/git/myproject/node_modules/nyc/node_modules/node-gyp'

and it turns out it was happening because I had removed my node_modules dir while a dependency was still symlinked. After running npm unlink mypackage and doing a fresh install, install is working for me.

@Shlomibo
Copy link

Seeing 5 new comments on this issue (including me) in the last week - makes it clear that this may be a regression or a new bug.
It started after switching to npm 5. Maybe there some incompatibility..

@dellinger
Copy link

Also encountering this exact error -- npm@5

@ayoayco
Copy link

ayoayco commented Jun 24, 2017

npm install became successful after I removed my app's node_modules directory (rm -rf node_modules). Wasn't able to find the root of the problem though.

divergentdave added a commit to konklone/oversight.garden that referenced this issue Jul 5, 2017
Trying to fix ENOENT error during `npm install`, see
npm/npm#9633
@kmolerov
Copy link

I was having the same issue, after migrating to npm 5.x. My problem and solution was the sama as the one of "dmartinesmedseek". Package-lock.json got out of sync after manually changing package.json. I had to delete package-lock.json and run npm install. Everything started working again.

@zurgul
Copy link

zurgul commented Jul 31, 2017

The same issue. It seems that npm tries hard to install everything described in package-lock.json, even packages that must not be installed on user's os/arch.

In our specific case there is a package that have optional dependency on fsevents. The developer with macbook published package-lock.json. Therefore "npm install" on windows computer throws errors. Second "npm install" finish installation without any errors. So, it looks like problem with processing of package-lock.json. Does anybody work on this issue?

@pb1975
Copy link

pb1975 commented Aug 5, 2017

Hi, I have the same problem (my own fault in allowing the package-lock.json file to get out of sync).
I want to uninstall Homebridge so I can start fresh with a clean install; but no uninstall instruction deletes Homebridge and it still runs.

Can anyone describe (step by step) the best way to uninstall completely please?
Or if there is a way to get package-lock.json and config.json files back in sync?

@abdullah353
Copy link

Hi i am not able to install koa-hbs, However it installed with -g parameter.

npm install koa-hbs

npm WARN sinon-chai@2.12.0 requires a peer of sinon@^1.4.0 || ^2.1.0 but none was installed.
npm WARN portfolio@0.0.0 No repository field.

npm ERR! path /Users/XAM/liimex/portfolio/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/readable-stream
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/XAM/liimex/portfolio/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/readable-stream' -> '/Users/XAM/liimex/portfolio/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/.readable-stream.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/XAM/.npm/_logs/2017-08-13T10_30_38_786Z-debug.log

Log file is over here

530 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "koa-hbs"
531 verbose node v8.3.0
532 verbose npm  v5.2.0
533 error path /Users/XAM/liimex/portfolio/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/readable-stream
534 error code ENOENT
535 error errno -2
536 error syscall rename
537 error enoent ENOENT: no such file or directory, rename '/Users/XAM/liimex/portfolio/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/readable-stream' -> '/Users/XAM/liimex/portfolio/node_modules/sqlite3/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/.readable-stream.DELETE'
538 error enoent This is related to npm not being able to find a file.
539 verbose exit [ -2, true ]

Is this issue is related to this one ?

@germansokolov13
Copy link

I was trying to run npm install in a shared folder /mnt/hgfs in an Ubuntu guest OS running on VMWare Workstation. Something wrong happens when istalling sync. It says "no such file or directory" but it exists when I check it. Moving out of /mnt/hgfs helps

npm ERR! Linux 4.10.0-19-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "webpack@2.1.0-beta.27"
npm ERR! node v4.7.2
npm ERR! npm  v3.5.2
npm ERR! path /mnt/hgfs/www/myproject/node_modules/.async.DELETE/node_modules/lodash
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/mnt/hgfs/www/myproject/node_modules/.async.DELETE/node_modules/lodash' -> '/mnt/hgfs/www/myproject/node_modules/async/node_modules/lodash'
npm ERR! enoent ENOENT: no such file or directory, rename '/mnt/hgfs/www/myproject/node_modules/.async.DELETE/node_modules/lodash' -> '/mnt/hgfs/www/myproject/node_modules/async/node_modules/lodash'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

@GDraP
Copy link

GDraP commented Aug 29, 2017

Hello,

@germansokolov13
I had the same issue on a laravel installation to install gulp.
I fixed it by following these steps

1 - Go in your ubuntu then at the root of your ubuntu (~/) create a folder like "nodes_module"
2 - In the ~/node_modules, install the packages you want in this directory
3 - Create in your app an empty directory where node package should be installed, for example "node_modules"
4 - Create a "bind mount" : "mount --bind ~/node_modules /mnt/hgfs/your/app/dir/node_modules"

Hope this help

@guzzyman
Copy link

Hi all,

I ran into the error below while trying to install angular packages for tooling via npm. I use windows 8 machine and this is my first time attempting to use Angular 2

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: webdriver-manager@12.0.6 (node_modules\protractor\node_modules\webdriver-manager):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime 'C:\Apps\angular2Projects\my-first-app\node_modules.staging\webdriver-manager-6eefb49c\built\lib\files\downloader.d.ts'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xmlbuilder@9.0.4 (node_modules\xmlbuilder):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime 'C:\Apps\angular2Projects\my-first-app\node_modules.staging\xmlbuilder-50d8e60e\lib\XMLAttribute.js'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: selenium-webdriver@2.53.3 (node_modules\webdriver-js-extender\node_modules\selenium-webdriver):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime 'C:\Apps\angular2Projects\my-first-app\node_modules.staging\selenium-webdriver-59492949\net\index.js'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: yargs@8.0.2 (node_modules\webpack\node_modules\yargs):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime 'C:\Apps\angular2Projects\my-first-app\node_modules.staging\yargs-1570756e\locales\fr.json'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: webdriver-js-extender@1.0.0 (node_modules\webdriver-js-extender):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime 'C:\Apps\angular2Projects\my-first-app\node_modules.staging\webdriver-js-extender-f2d244dc\built\spec\mock-server\interfaces.js.map'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.5.3 (node_modules\node-sass):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime 'C:\Apps\angular2Projects\my-first-app\node_modules.staging\node-sass-1c5bff97\src\libsass\docs\build-with-mingw.md'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: stylus@0.54.5 (node_modules\stylus):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, open 'C:\Apps\angular2Projects\my-first-app\node_modules.staging\stylus-29636ebc\lib\colors.js'

npm ERR! code EINTEGRITY
npm ERR! sha1-ot6l2kqX9mcuiefKcnbO+jZRR6c= integrity checksum failed when using sha1: wanted sha1-ot6l2kqX9mcuiefKcnbO+jZRR6c= but got sha1-79M9EL51oiR0MTt9wbjUr6v//js=. (327152 bytes)

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ayodeji.olotu\AppData\Roaming\npm-cache_logs\2017-08-29T22_57_55_712Z-debug.log

Package install failed, see above.
Package install failed, see above.

Please how can I resolve this error?

@mrjohnskelton
Copy link

npm cache clean --force
worked for me. Comes with a health warning,.. I don't really understand what I''m doing yet! :-)

@iarna
Copy link
Contributor

iarna commented Nov 16, 2017

I'm closing this because the more recent things are not in any way related to the OP (which was fixed a long time ago). The more recent issues will likely be fixed by one of the things in #19054.

@boutell
Copy link

boutell commented Jan 26, 2018

I experienced what sure looks like the original issue today:

ENOENT: no such file or directory, rename '/Users/boutell/node-sites/apostrophe-multi-demo/node_modules/.staging/apostrophe-03e57d21/node_modules/abbrev' -> '/Users/boutell/node-sites/apostrophe-multi-demo/node_modules/.staging/abbrev-be0bd5d4'

Clearing node_modules and force clearing the cache did not help, neither did switching to another node version with npm, etc.

However, removing package-lock.json and trying another clean npm install with an empty node_modules DID fix the issue. Offering that up for the next person.

Using npm 5.6.0.

@dmail
Copy link

dmail commented Jan 26, 2018

I vaguely remembers that after using npm link npm was creating a messed up package-lock.json leading to such errors on npm install in travis.

@boutell
Copy link

boutell commented Jan 26, 2018 via email

@jdmarshall
Copy link

jdmarshall commented May 2, 2018

I'm seeing this problem in a situation where we are calling

npm install packageA@version packageB@version...

Is anyone seeing this for just a plain npm install with no arguments?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.