0

I tried to run this command on linux on google cloud . I am on node v14.21.3 and npm 9.7.2

npm install @wordpress/scripts --save-dev

but it gets stuck at fetchMetadata: and become very slow .

I found this question and as mentioned in top answer , I did

npm config set registry http://registry.npmjs.org/ --global
npm cache clear --force
npm install --verbose @wordpress/scripts --save-dev` 

and got this error

(#########⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠇ reify:fsevents: verb audit error HttpErrorGeneral: 426 Upgrade Required - POST http://registry.npmjs.org/-/npm/v1/security/audits/quick

I looked around and based on this question , I set the registry as

npm config set registry https://registry.npmjs.org/

and also did npm cache clear --force

and ran command npm install @wordpress/scripts --save-dev again and now I get

ENOTEMPTY: directory not empty, rename '/var/www/html/wp-content/themes/travel/node_modules/babel-loader' -> '/var/www/html/wp-content/themes/travel/node_modules/.babel-loader-P0fx9R40'

I tried to remove node_modules by running npm remove node_modules but I still get

ERR! ENOTEMPTY: directory not empty, rename '/var/www/html/wp-content/themes/travel/node_modules/babel-loader' -> '/var/www/html/wp-content/themes/travel/node_modules/.babel-loader-P0fx9R40'

How do I resolve this and install @wordpress/scripts using npm and how do I make sure that I do not get this kind of issues. Is there something missing in npm and node setup ?

UPDATE:: I tried to run again after doing rm -rf node_modules the installation did not even reach error , it is so slow that it only reach this and then stuck at that point

....
npm http fetch GET 200 https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz 225800ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz 227046ms (cache miss)
npm http fetch GET 200 https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz 227349ms (cache miss)

UPDATE2::. I also tried this npm set maxsockets 3 from here but the installation gets stuck at reify:postcss-safe-parser: timing reifyNode:node_modules/svg-tags

Also I tried downgrading to npm 6 as mentioned here but it gets stuck at fetchMetadata: sill resolveWithNewModule devtools-protocol@0.0.981744 checking installable status

UPDATE3:: I tried with fresh install of nvm, npm and node but it did not help either. Also I tried using npm config set strict-ssl true but that also didn't help and npm install @wordpress/scripts --save-dev was slow and is still running for half hour .

UPDATE4:: On a different compute engine instance( on which I do not have apache2 , wordpress and ssl) I was able to run npm install @wordpress/scripts --save-dev successfully and it took 5 minutes to install the package

Is there a way to debug this without having to start from scratch like reinstalling everything again and checking in between for npm install and see which installation is causing the slowness ?

can someone please help?

user1207289
  • 3,060
  • 6
  • 30
  • 66
  • Do you have an anti virus running perhaps? I've seen them interfere with `npm install`s by taking locks on files when being renamed. Also, try reinstalling npm (updating Node.js is probably the easiest way) – Benjamin Gruenbaum Jul 05 '23 at 18:00
  • I switched node versions using nvm and used 18.16.1 and then ran `npm remove node_modules` but still the same above error . My npm is 9.5.1 . I am not sure how to know if there is antivirus running as I am doing all this on VM instance in google cloud. – user1207289 Jul 05 '23 at 18:33

1 Answers1

0

All of the solutions that I linked above or found elsewhere did not worked for me. The only thing worked was to install everything again on a new google cloud instance. This time I purposefully increased the RAM( not saying that RAM was the issue but I just increased it). I installed Apache , PHP , MySQL , Wordpress again and then installed node, npm and did npm install @wordpress/scripts --save-dev , it worked and took about a min to install the package.

user1207289
  • 3,060
  • 6
  • 30
  • 66