Repository navigation
[BUG] NPM Install generates TAR_ENTRY_ERROR ENOENT: no such file or directory #3910
Description
This bug is observed anytime you install by targeting a repo with git+http that contains an npm workspace. In the below example, I am creating this with Angular library which is itself an npm workspace. However, this bug may be possible to create without workspaces too.
I believe the question here is what is the desired behavior with
npm install git+https://server.com/npm_workspace.gitCurrently the behavior is erratic unpredictable and loud.
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
One of three things will happen, you'll get an error like this,
npm WARN using --force Recommended protections disabled.
npm WARN tar ENOENT: Cannot cd into '/usr/local/lib/node_modules/my-workspace/node_modules/tslib'
npm WARN tarball tarball data for tslib@https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz (sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==) seems to be corrupted. Trying again.
npm WARN tar ENOENT: Cannot cd into '/usr/local/lib/node_modules/my-workspace/node_modules/tslib'
npm WARN tarball tarball data for tslib@https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz (sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==) seems to be corrupted. Trying again.
npm ERR! code ENOENT
npm ERR! path /usr/local/lib/node_modules/my-workspace/node_modules/tslib
npm ERR! enoent ENOENT: Cannot cd into '/usr/local/lib/node_modules/my-workspace/node_modules/tslib'
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! /root/.npm/_logs/2021-10-18T18_58_34_554Z-debug.log
Or you may get a lot of errors like this,
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/add'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/add'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/internal'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/internal'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/observable'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/operator'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/operators/zip.ts'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/add/operator/zipAll.d.ts'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/internal/operators/zipAll.d.ts'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/operator/zipAll.d.ts'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/operators/zipAll.d.ts'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/add'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/internal'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/operator'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/operators/zipAll.ts'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/_esm2015/LICENSE.txt'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/_esm5/LICENSE.txt'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/LICENSE.txt'
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/usr/local/lib/node_modules/my-workspace/node_modules/rxjs/src/LICENSE.txt'
Or it may just work, god speed!
Expected Behavior
It works or fails consistantly with a reason.
Steps To Reproduce
- Have an npm-workspace up
#. Follow these instructions to create a boiler plate angular library after you run those commands be sure commit all the file
#. Use this one that I've created here - Run
npm install -gf "git+https://github.com/EvanCarroll/trash_npm_test.git"(or target the repo you've created)
Note if you don't want to pollute your environment you can do this in Alpine with a user namespaced container with
$ podman run -ti node:16-alpine /bin/sh
# apk add git
# npm install -gf "git+https://github.com/EvanCarroll/trash_npm_test.git
Environment
- OS: tested on Debian Bullseye, and Alpine
- Node: tested on Node v16.11.1
- npm: tested on 7.24.1, 8.0.0, 8.1.0
Note, I believe this error report speaks to these questions on StackOverflow,
- ENOENT: no such file or directory when running npm install command, which has 31k views.
- NPM "ENOENT: no such file or directory error" when installing Sails.js dependencies with Node 8.9.4 LTS 78k views, 3 yrs 9 mo old
It's hard to even scope this problem, as there are over 1000 questions which include an ENOENT generated on install
Activity
[-][BUG] TAR_ENTRY_ERROR ENOENT: no such file or directory[/-][+][BUG] NPM Install generates TAR_ENTRY_ERROR ENOENT: no such file or directory[/+]dominykas commentedon Nov 9, 2021
Can confirm I can see this as well in 8.1.3.
I guess I can just add that the net result in the global folder is a symlink to a folder under
~/.npm/_cache/tmp, which has no files (only the directory structure).DavidHooper commentedon Nov 11, 2021
Having the same issue upgrading from docker node version 12 to 16 with npm 8 where npm install is happening on a mounted volume. The only way to make it work is by installing in another directory and moving node_modules over to the mounted volume. This was working with npm 5.
An example script below for how we overcome the issue.
mrrobbins commentedon Nov 17, 2021
I am also experiencing this error with npm install. It produces many errors like:
npm WARN tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat <omitted/some/node_module/path>which fails the install with the below as the final output:
I am able to reproduce with npm 7 and npm 8 using various projects. The error does not happen with npm 6.
Related to @DavidHooper comment, my company uses virtualized Windows machines with mounted disk volumes. This is preventing us from using Node.js 16 with npm 8.
DavidHooper commentedon Nov 18, 2021
Update on what we've moved to over the last week.
Moved to Docker Sync, which works well for us on macs. We no longer have the npm issue due to not having to deal with host mounted volumes.
https://docker-sync.readthedocs.io/en/latest
mrrobbins commentedon Nov 29, 2021
We are still stuck on this issue preventing us from using npm 8 within our company. This appears to be related to mounted drives. Do we know what the cause of the issue is?
nlf commentedon Mar 24, 2022
can you folks try this again with the latest npm release? version 8.5.5 had some fixes related to workspaces within git dependencies that i think should resolve this. i'm unable to reproduce it after updating.
mshima commentedon Mar 24, 2022
I've just got hit by some error like this using
npm install -g github:mshima/generator-jhipster-ionic#esmnlf commentedon Mar 28, 2022
was this with npm@8.5.5?
mshima commentedon Mar 29, 2022
yes.
nlf commentedon Apr 11, 2022
i'm unable to reproduce this. using your command as-is, i get an error that reads:
but this is because the
esmbranch does not exist in your repository any more. dropping it and installing the main branch does not show the error for me. are you still able to reproduce this?mshima commentedon Apr 11, 2022
@nlf just realized that my problem was related to husky requiring
"prepare": "husky install"script.prepareis not exclusive to dev andhuskyis a dev dependency.So prod install was broken.
npm install -g jhipster/generator-jhipster-ionicis working after removing thepreparescript.Thanks.
nlf commentedon Apr 12, 2022
I'm going to close this issue, if anyone is still experiencing problems like this please open a new issue and provide as much information as you can to help us reproduce the problem you're seeing.
ng-druid commentedon Jun 8, 2022
I had same issue today for my first time using github actions. The problem seems to be isolated to node version 14.x. I changed the node version to 16.x and the dependencies in package json installed without these critical errors.
ramakrishna-kodukula commentedon Mar 9, 2023
I'm getting error when i try to create a my first angular app with below versions.
Angular CLI: 15.2.1
Node: 18.15.0
Package Manager: npm 9.5.0
OS: win32 x64
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\Examples\Angular\myApp\node_modules.bin\ng.ps1'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
afa4 commentedon Jul 20, 2023
Nice workarround bro, thanks @DavidHooper
vivostar commentedon Oct 14, 2023
the problem just come from local machine file handler limits. We should check it on current session
ulimit -nif the number is so small, we should change it larger.
that work for me.