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?