gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Can't NPM Install: ENOENT: no such file or directory .staging/core-js-c2a9e69c (solved with `rm -rf node_modules && npm install`)

Open mintplugins opened this issue 8 years ago • 49 comments

Describe the problem When attempting to run npm install in the Gutenberg directory, it fails with this error:

`ENOENT: no such file or directory, rename '[removed path to my local WP enironment]/wp-content/plugins/gutenberg/node_modules/.staging/core-js-c2a9e69c' -> '[removed path to my local WP enironment]/wp-content/plugins/gutenberg/packages/hooks/node_modules/core-js'

To Reproduce Steps to reproduce the behavior:

  1. Install Local by Flywheel and install WordPress.
  2. Clone gutenberg repo into the wp-content/plugins directory
  3. Attempt to run npm install while in that directory in Terminal on Mac
  4. Error above happens and npm is not installed.

Expected behavior I expect NPM to install without any issues.

Desktop (please complete the following information):

  • OS: OSX Version 10.11.6
  • Browser: Chrome Version 68.0.3440.84

** Additional Information** The node_modules directory does get created before it fails, and I see a .staging file in that directory during setup, but it is ultimately removed by the time the error happens in Terminal. See screenshot of node_modules directory:

screen shot 2018-08-30 at 11 07 26 am

Any assistance would be highly appreciated.

mintplugins avatar Aug 30 '18 15:08 mintplugins

Delete package-lock.json and run npm install.

Hey @mintplugins, which version of node and npm do you use? Are you using Malwarebytes on your computer?

Soean avatar Aug 30 '18 16:08 Soean

@Soean Thanks for the response.

NPM version: 5.6.0 Node version: v8.11.4

I do not use Malwarebytes.

Unfortunately, deleting package-lock.json did not result in any changes while running npm install. I am still getting the same error.

mintplugins avatar Aug 30 '18 16:08 mintplugins

I just upgraded NPM to version 6.4.1, but it did not result in any changes either. I am still getting the same error.

mintplugins avatar Aug 30 '18 16:08 mintplugins

@mintplugins, thanks for opening this issue.

After running npm install, I'm also seeing a similar error message to the one you reported.

npm ERR! path <my-local-path>/gutenberg/node_modules/@wordpress/hooks/node_modules/core-js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '<my-local-path>/gutenberg/node_modules/@wordpress/hooks/node_modules/core-js' -> '<my-local-path>/gutenberg/packages/i18n/node_modules/core-js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

Node: v8.11.4 NPM: v6.4.1

kienstra avatar Sep 02 '18 18:09 kienstra

I've run into this issue quite often ~1 month ago. rm -rf node_modules && npm install resolves the issue for me.

@ntwb Is this issue being tracked somewhere?

danielbachhuber avatar Sep 11 '18 00:09 danielbachhuber

Not tracked anywhere, it's a common issue, maybe it should be documented in the repo somewhere

ntwb avatar Sep 11 '18 04:09 ntwb

maybe it should be documented in the repo somewhere

I wasn't able to find a good place for this in our existing documentation. We have CONTRIBUTING.md, but it doesn't have a section for debugging / known issues like this. Plus, the issue would ideally be resolved, not something developers have to live with.

With this being said, searching GitHub issues is fairly standard practice. Given the specificity of this error, I think we can have it live in GitHub issue history for now.

danielbachhuber avatar Sep 11 '18 11:09 danielbachhuber

@danielbachhuber I tried running the code you provided, but after running it, which took about 20 minutes to complete, I tried to run npm install again, and unfortunately I am still getting the exact same error. That code does not seem to have resolved anything in my situation.

mintplugins avatar Sep 11 '18 14:09 mintplugins

@danielbachhuber False alarm - it does seem to have worked now! Great - thank you!

mintplugins avatar Sep 11 '18 14:09 mintplugins

Close the vs code and go to directory via terminal and install npm from the terminal.

vishkpanicker avatar Dec 03 '18 13:12 vishkpanicker

My node version is 8.12.0 npm version is 6.4.1

I also got this issue today only & I have resolved it by removing package-lock.json file & then try to install packages with --unsafe-perm Example -

rm -rf package-lock.json npm install pachageName --unsafe-perm

It works for me

azanwar30 avatar Jan 09 '19 15:01 azanwar30

on windows, run terminal as Administratior work fine for me

TechNov avatar Jan 31 '19 13:01 TechNov

If there is a character or a space other than the English characters from the user name, it can also be caused by this.

I'm talking about the installation of global packages. If you are installing a package on a specific project, it may also be caused by the lack of package.json.

ismaildenzzz avatar Feb 03 '19 09:02 ismaildenzzz

npm ERR! path D:\TutsGalaxy\angular-and-node\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'D:\TutsGalaxy\angular-and-node\package.json'
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!     D:\Program Files\nodejs\node_cache\_logs\2019-02-14T12_50_27_473Z-debug.log

How do you solve this problem?

chenyang48671155 avatar Feb 14 '19 13:02 chenyang48671155

In my case npm set strict-ssl false

rafalfaro-actr avatar Mar 15 '19 22:03 rafalfaro-actr

In my case, I removed the node_modules folder and the package-lock.json and then I was able to successfully run npm i.

cs-manughian avatar Apr 22 '19 16:04 cs-manughian

Close the vs code and go to directory via terminal and install npm from the terminal.

It works, thanks mate....

sociojs avatar May 03 '19 17:05 sociojs

I've just come across this and thought it worth adding my experience with the same error.

Our build passes, but executing the same commands locally doesn't.

One thing I found was that our build (on Bitbucket Pipelines) was using npm install rather than npm ci. It seems that this is essential for repeatable builds.

nealeu avatar Jun 03 '19 13:06 nealeu

I've tried to install the package in CMD instead of the terminal of the VSCode. use CMD (Command Prompt). it works for me

CoderHana avatar Jul 27 '19 14:07 CoderHana

That may sound a bit weird but i fixed it by creating a new folder in a different path.

cemilakkoc avatar Jul 30 '19 14:07 cemilakkoc