npm / npm

This repository is moving to: https://github.com/npm/cli

Home Page:http://npm.community

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ENOENT errors, `.staging`?

tejasmanohar opened this issue · comments

npm WARN enoent ENOENT: no such file or directory, open '/root/dev/src/github.com/segment-sources/zendesk/node_modules/esrecurse/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/root/dev/src/github.com/segment-sources/zendesk/node_modules/fs-plus/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/root/dev/src/github.com/segment-sources/zendesk/node_modules/grpc/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/root/dev/src/github.com/segment-sources/zendesk/node_modules/doctrine/package.json'
npm WARN @segment/eslint-config@3.2.1 requires a peer of eslint-plugin-react@^4.0.0 but none was installed.
npm ERR! Linux 4.4.15-moby
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.3
npm ERR! path /root/dev/src/github.com/segment-sources/zendesk/node_modules/.staging/mkdirp-b0f0282a
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/root/dev/src/github.com/segment-sources/zendesk/node_modules/.staging/mkdirp-b0f0282a' -> '/root/dev/src/github.com/segment-sources/zendesk/node_modules/@segment/source/node_modules/grpc/node_modules/node-pre-gyp/node_modules/mkdirp'
npm ERR! enoent ENOENT: no such file or directory, rename '/root/dev/src/github.com/segment-sources/zendesk/node_modules/.staging/mkdirp-b0f0282a' -> '/root/dev/src/github.com/segment-sources/zendesk/node_modules/@segment/source/node_modules/grpc/node_modules/node-pre-gyp/node_modules/mkdirp'
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

full output- https://gist.github.com/tejasmanohar/ed2497ed7d35d37d9b485134d2a3f1a3
npm debug log- https://gist.github.com/tejasmanohar/93f63476e7bed1bba92c81dc083d2bec

npm -v -> 3.10.3
node -v -> v6.3.1
*nix, ubuntu 16, docker

I see the same error with node_modules/.staging on npm@3.10.3 while trying to install a package where all dependencies are bundled. npm@2.14.12 works good on the same package.

It looks like that node don't write anything into .staging folder and then tries to mv things outside.

Looks related #13514

Works for me on Mac (outside my Docker container). Not sure why.

For me this also happened reproducible with a different library.

I believe this to be related to #9863

@kvervo 9863 seems to deal almost exclusively with Docker users getting EXDEV errors. I only saw one person mention ENOENT and the missing file wasn't package.json. Also, I'm getting this when using plain ext4, not on aufs via Docker.

Of course, that's not to say there's never a relation to 9863 as several here have said they are using Docker and/or that it works outside.

I'm on my phone now but will edit this comment later to add which packages I am getting this with.

EDIT: I had this issue on Aug 18 and 19 using a normal filesystem but I don't have the issue now. This was in the process of changing task runners and upgrading a lot of packages and I have not been able to identify the combination of factors causing. So regrettably all I can add/confirm is that it can happen outside of Docker.

npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/jobs/obfuscation/workspace/hand-waving/node_modules/angular-qr/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/jobs/obfuscation/workspace/hand-waving/node_modules/angular-ui-calendar/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/jobs/obfuscation/workspace/hand-waving/node_modules/angular-ui-chart/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/jobs/obfuscation/workspace/hand-waving/node_modules/angular-workers/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/jobs/obfuscation/workspace/hand-waving/node_modules/datatables/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/jobs/obfuscation/workspace/hand-waving/node_modules/datatables-tabletools/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/jobs/obfuscation/workspace/hand-waving/node_modules/jqplot/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/jobs/obfuscation/workspace/hand-waving/node_modules/qrcode/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/jobs/obfuscation/workspace/hand-waving/node_modules/qrcode.js/package.json'

Same as #11265 ?

I ran into a similar issue, where this only happened when installing the scoped package using npm v3.x.x, while the npm v2.x.x did not have the issue.

And here is also my npm-debug log:
https://gist.github.com/muhammadghazali/801d48cfcc54c63cefe6cd5348e9e20a

fixed by updating npm

Ran into this on npm version 4.2.0. Updating using npm install npm@latest -g to 5.0.0 fixed the issue.

Getting the same error on Windows on 5.3.0.

Getting the same error on Mac, npm@5.3.0

Getting the same error on Windows, npm@5.3.0

I also have it on npm@5.3.O

Same problem on npm@5.4.2 too (node@8.7.0) on macOS Sierra 10.12.6.

OK, got it solved by removing `package-lock.json' file.

I was on node 7 then upgraded to node 8. Required steps:

npm cache clean --force
rm -rf ~/.npm
# In the project folder:
rm -rf node_modules
rm -f package-lock.json

Thanks @DerekDomino, I had this error on a fresh server, and your reply solved it.

I'm on npm 5.6.0 and I'm still getting this. Any updates? Removing package-lock did fix it, but it's not an acceptable fix, as this is occurring in our build servers.

I belive this issue should be reopened.

This is happening to me as well.

@srossross update npm to latest version.

I'm getting this error using the latest docker image and no package-lock.json

To anyone getting this error I'd honestly advise to switch to yarn. In my experience it has been much more reliable; with npm I'd get errors like this one, or the can't get property 0 of undefined one for no apparent reason. So much for determinism...

At my work and on personal projects we're in the process of migrating to yarn, and I couldn't be happier.

Still having this issue on 5.8.

From what I can tell, it always happens on the preinstall step AND when there are local packages depended on, i.e. "packageName": "file:../foobar"

NPM seems to have multiple issues when including local files, in fact.

In a multi-package system, I fix these errors by using a helper script that does the following. In order of packages with no dependents to packages depending on other "unit packages" in my system (i.e. where "unit packages" means packages that depend on no other packages on my local filesystem):

  • change directory to package directory
  • delete package-lock.json
  • delete node_modules
  • npm install

My suspicion is that there are issues to do with symlinking that occurs with packages installed via the local filesystem. These may be Windows specific issues. In particular, when installing from the local filesystem, package versions are not respected/updated as usual. Therefore my understanding is that as versions become out-of-date errors occur.

I can confirm that we are also seeing this error with the scenario that @mikegwhit described above (i.e., preinstall step with a local package). This occurs on our Linux build servers (Docker), node 8.1.2, npm 5.0.3. We do not see this in local dev environments (OSX).

@peripateticus try updating to the latest version of npm.

@legodude17 It looks like this is happening though even in npm 5.8 (which is later version than the version distributed with LTS). Was this fixed in version > 5.8?

I don't know, but it might be.

Same here (tried on npm version 5.10 and 6.0.1) (CentOS)

same issue with node 8.11.2 on docker instance running on centos

Same issue described by @mikegwhit (depending on a local package) with npm 6.1.0 on Ubuntu.

Same issue with npm@6.1.0 and node@8.9.4, but this particular package isn't using any local dependencies

I've had this same problem when building with npm@6.1.0 for several of our company repos. When I remove package-lock.json before running npm install it works without problems, but when I keep package-lock.json it does not always work. We also use local repositories ("file:my/module/path") and the repositories with dependencies on other local repositories are the ones that seem to not work. If I encounter the problem then it works if I run npm install my/module/path and then npm install, for some reason. (?)

I haven't been able to replicate it in a PoC tough...

Same for us. This happens during the build phase of the Docker image and it seems that removing the package-lock.json file fixes it. However, it's not a feasible approach so any piece of advice is appreciated.

this is happening for us as well. Deleting the package-lock.json seems to defeat the purpose of it. any word on why this causes/fixes the issue?