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

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.

45 Answers

✔️Accepted Answer

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?

Other Answers:

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

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?

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

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

More Issues: