1
votes

When I npm install package, npm says that it successfully installed the package, but when I look for it in the node_modules folder, the package is not in the folder. When I npm install -g package, the package gets installed into the global /node_modules folder, so I have to drag the package from the global folder to the local folder.

Why is npm install not installing into my local /node_modules folder?

2
are you using vscode terminal to install the package? - Furqan Aziz
Do you have a package.json in the directory you're installing from? - Aplet123
I am using powershell in vscode terminal, and my package.json is in the same directory as /node_modules - Daniel Wilczynski
If you require the package after installing it, does it error? - Aplet123
Aplet123 what do you mean by require? - Daniel Wilczynski

2 Answers

0
votes

There are a few things you can do to resolve this problem, as mentioned here.

First, try deleting your package-lock.json file. If you run npm install or npm i after that it should generate a brand new installation with no reference to an existing package-lock.json file.

If that doesn't work, try deleting your node_modules directory in your project. Then run npm install or npm i.

If THAT doesn't work, you should try deleting both the node_modules directory AND the package-lock.json. Then run npm install or npm i. This should resolve the issue.

0
votes

possible solution:

× npm init -> creates package.json

× check npm version in cmd with 'npm -v'

× add this version to package.json

example:

"dependencies": {

"node": "^v6.14.13"

},

× run 'npm i'