Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do Node modules go into .staging folder?

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 go into a subfolder called .staging. Each module also has -xxxxx appended to it, where the x's are some random alphanumerics.

Other Electron apps I've created have never done this. All the node modules sit in the root of node_modules and don't have -xxxxx appended.

Any idea why this is happening?

like image 305
4thSpace Avatar asked Jun 15 '17 17:06

4thSpace


People also ask

What is .staging folder in node_modules?

While doing npm install, inside node_modules . staging folder is getting created. Reasons: This is a temporary folder where the modules will be kept untill npm downloads all the modules specified in the package.

Where should node modules folder be?

On Unix systems they are normally placed in /usr/local/lib/node or /usr/local/lib/node_modules when installed globally. If you set the NODE_PATH environment variable to this path, the modules can be found by node. Non-global libraries are installed the node_modules sub folder in the folder you are currently in.

Why is node modules folder so big?

The module structure used to be completely nested, meaning multiple versions of the same modules could be nested within each other. This is no longer the case, so module sizes are not as big as they used to be. However; lots of people still ship a tremendous amount of “fluff” with their modul...

Can you delete node modules folder?

Solution. Using 'Git Bash' to remove the folder is the simplest way to remove all folders including subfolders in the 'node modules'. It will take a while to delete everything, but it works without any installation.


Video Answer


1 Answers

I was also facing the same issue, I tried the steps below:

  1. Delete package-lock.json
  2. Delete Node Modules folder
  3. 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.

like image 137
atul parate Avatar answered Sep 23 '22 18:09

atul parate