npm install stuck at extract: zone.js
Asked Answered
Q

6

17

I am not an expert on JS so this problem might have an easy solution. I am trying out .Net Core Angular SPA template. When I try to run npm install command, it gets stuck on extract:zone.js step. Here is the command output.

D:\Projects\UI>cd ClientApp

D:\Projects\UI\ClientApp>npm install
[       ...........] / extract:zone.js: verb lock using C:\Users\rahul\AppData\Roaming\npm-cache\_locks\staging-f4d27da8ef6cdab8.lock for D:\Projects\UI\ClientApp\node_modules\.staging

I tried reinstalling node and npm, but it doesn't seem to make a difference. Here is my node and npm version.

D:\Projects\UI\ClientApp>npm version
{ AngularMaterial: '0.0.0',
  npm: '6.4.1',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.12.0',
  openssl: '1.1.0i',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.35',
  zlib: '1.2.11' }

I haven't added or removed anything from the default .net core Angular SPA template. Thanks for help.

More details Here are the commands that I have already tried.

D:\Projects\UI\ClientApp>npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.

D:\Projects\UI\ClientApp>npm install --verbose
npm info it worked if it ends with ok
npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Users\\rahul\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'install',
npm verb cli   '--verbose' ]
npm info using [email protected]
npm info using [email protected]
npm verb npm-session 4b2214d86e04af5b
npm info lifecycle [email protected]~preinstall: [email protected]
npm timing stage:loadCurrentTree Completed in 12ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 494ms
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 678ms
npm timing stage:loadIdealTree Completed in 1408ms
npm timing stage:generateActionsToTake Completed in 352ms
npm verb correctMkdir C:\Users\rahul\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
npm verb lock using C:\Users\rahul\AppData\Roaming\npm-cache\_locks\staging-f4d27da8ef6cdab8.lock for D:\Projects\NamitUI\ClientApp\node_modules\.staging
npm timing audit compress Completed in 233ms
npm info audit Submitting payload of 66762bytes
npm timing audit submit Completed in 1900ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 1903ms
npm timing audit body Completed in 4ms
[       ...........] / extract:zone.js: timing audit body Completed in 4ms

Running the command with -ddd flag generates similar output with the last few steps looking like this. Here is the pastebin for complete log: https://pastebin.com/gnvn1wHe

npm sill tarball trying [email protected] by hash: sha1-GdOGodntxufByF04iu28xW0zYC0=
npm sill tarball trying [email protected] by hash: sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=
npm timing audit submit Completed in 2163ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 2014ms
npm timing audit body Completed in 4ms
[       ...........] / extract:zone.js: timing audit body Completed in 4ms
Quahog answered 20/10, 2018 at 1:33 Comment(3)
Run npm with -ddd flag, then you will find out which URL it tries to fetch and gets stuck. Either there is a network issue or there is a dependency which is blocking the extraction process.Handle
looks still the same. I have updated the question with output of the command.Quahog
I just waited for sometime, and it worked.Moxa
B
17

Little late to answer, I hope will help someone else.

Delete package-lock.json and remove node modules folder. Try again with npm cache clean --force (you might get a warning because this cleaning process is handled by npm itself.) and then npm install --save

I was facing the same problem. It worked for me.

Bisitun answered 14/10, 2019 at 6:58 Comment(2)
When calling npm I get a black screen that goes away after one second. I am behind a corporate firewall and would like to call npm install for a reveal.js app.Forewarn
Can confirm. Deleting node modules did the trick for me after downgrading npm from v7 to v6Psychotechnics
F
1

I had the same issue and i fixed it by changing the registry from

http://registry.npmjs.org/

to

https://registry.npmjs.org/

To change the link you can use

npm config set registry <link>

or you can also open the npm's configuration file with

notepad ~/.npmrc

and change the registry line with the right link.

registry=https://registry.npmjs.org/

I think the issue come from the proxy of my company I added to npm. It requires to use https

Forefront answered 10/12, 2019 at 13:53 Comment(0)
G
1

One time I got stuck because the registry(not npmjs.org) was inaccessible unless i am on our organization's VPN. Issue resolved after connecting.

Goebbels answered 2/3, 2022 at 1:3 Comment(1)
Thank you so much for this, this was my issue. You can check with npm config get registry to see if yours is private.Bandeen
E
0

I had the same issue with npm install and I upgraded both node and npm and it worked.

Epimorphosis answered 13/1, 2022 at 16:16 Comment(0)
B
0

I experienced this for an old repo using node 16.10~. I tried 14,12,10, they were all even more broken during install. Eventually tried 16.22, and that suddenly worked.

Good luck.

Behind answered 3/10, 2022 at 22:43 Comment(0)
S
0

Random note: when npm seems to be stuck, it might be stuck on a different thing than it shows. On Linux, do a ps axf | grep npm -C3 to show what npm and its subprocesses are up to. For example, if you see there's some git ls-remote child process staying around for long, likely it is the one thing stuck. Investigate why. (Other more heavy-weight option is to strace the process to see what it is doing, but likey you won't need this).

Scroll answered 13/4, 2023 at 17:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.