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?
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?
Share Improve this question asked Apr 12, 2020 at 14:39 Daniel WilczynskiDaniel Wilczynski 511 gold badge1 silver badge3 bronze badges 6- 1 are you using vscode terminal to install the package? – Furqan Aziz Commented Apr 12, 2020 at 14:41
-
Do you have a
package.json
in the directory you're installing from? – Aplet123 Commented Apr 12, 2020 at 14:41 - I am using powershell in vscode terminal, and my package.json is in the same directory as /node_modules – Daniel Wilczynski Commented Apr 12, 2020 at 14:43
-
If you
require
the package after installing it, does it error? – Aplet123 Commented Apr 12, 2020 at 14:43 - Aplet123 what do you mean by require? – Daniel Wilczynski Commented Apr 12, 2020 at 14:49
3 Answers
Reset to default 0There 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.
step 1) rm -rf ./node_modules
from your root directory.
step 2) npm install
.
The above mands first deletes your node_modules and then reinstalls all the packages that are found inside your package.json.
This is the same problem I was facing, both the above mands resolved the problem in my case.
If the above
solution does not
work in your case :
The problem is :
Data is not being fetched
from the package.json
, you must check whether you have written the correct statement
or not
inside
your package.json
.
Here's what worked for me:
- Find file named .npmrc (for me it was in
C:/Users/username
) - Open it and if you have
location=global
ment it out with # - In your project folder run
npm ci
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744943850a4602495.html
评论列表(0条)