Today, after git clone a project, I found npm i and found that there is no node_modules package under my file, but there is a prompt as shown in the figure: but there are no new files in the folder
added 1 package in 674ms
Then check C:\Users\Jun\AppData\Roaming\npm\node_modules
Figure 1:
There are files generated after executing npm i today, so I execute it under cmd
npm config list
Figure II:
Some people may only have global in the first arrow in the picture , but I have two, so I directly changed both to false
Let me talk about the first global modification first. Most of the recommended modifications on the Internet are to execute code modifications, but sometimes or for some students it cannot take effect, that is, to execute
npm config set global = false
Re-execute
npm config list
The displayed result is still global = true
!!! Note that I personally recommend manual modification, 100% can modify the code, follow the path below to find the npmrc file in etc by comparing it with the path of your computer folder
C:\Users\俊\AppData\Roaming\npm\etc
Open the npmrc file, write global = false, it is recommended to write a new sentence behind the original code
Figure 3:
After executing the above sequence, execute npm i to download the dependent package [node_modules] to the folder
Next, let’s talk about the global of the second arrow in Figure 2, and also find the path first
C:\Users\Jun------The Jun here is on my computer, your own computer is different
Then find the .npmrc file
Figure 4:
Still open the file for modification, note that it is not nrmrc, but npmrc
write global=false
Figure 5:
Finally, just run npm i