I have an Electron app that I\'m trying to install node modules for. When I run npm install
, it creates the node_modules
folder but all the modules
If you're automatically installing node_modules using CI/CD you should check out npm ci. Also check out this Stackoverflow question.
npm ci
The documentation points out the differences between npm install
and npm ci
.
package-lock.json
or npm-shrinkwrap.json
package.json
, npm ci
will exit with an error, instead of updating the package lock.npm ci
can only install entire projects at a time: individual dependencies cannot be added with this command.node_modules
is already present, it will be automatically removed before npm ci
begins its install. This is nice, because it prevents having to do something like rm -rf node_modules
.package.json
or any of the package-locks: installs are essentially frozen.I faced similar issue and tried the above answers but it did'nt worked for me; I followed below steps to resolve this issue-
1.npm audit
By running npm audit I got list of pending packages to install-
2.npm i packagename
After installing one or two package one by one from list, I used
3.npm install
At this time the installation went smooth without any lag or hangup. Hope this help who is facing similar issue :).
This only happens temporarily until the modules are downloaded and installed. Node seems to do this so it can place together common submodules from all the modules you are installing so it can better structure the node modules folder(mainly for windows users).
If this is happening after an npm install finishes it is likely that there is something wrong with your node installation or something in the install failed.
This worked for me I moved the project from C drive to other drive and ran the following commands take a backup of older node modules if you are running this and existing project
npm clear cache --force
npm update
I was having 2 versions of node installed on my system.
nodejs v4.2
and node v8.6
I thought this could be conflicting, so I deleted nodejs v4.2
with following commands.
sudo apt-get remove nodejs
and linked the path with
sudo ln -s /usr/bin/node /usr/bin/nodejs
Again I ran npm install
and it got fixed
I was also facing the same issue, I tried the steps below:
Try installing it using below command (should be in open network)
npm install
Note: - ".staging" means, those dependencies are getting downloaded so for the temporary basis it keeps all those dependencies under ".staging" folder. Once all gets downloaded properly then it will showcase them under node_modules only.
I hope this will work.