Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does npm install a bunch of .cmd files on my project root folder?

Why does npm install a bunch of files and .cmd files on my root folder? If I remove the files and run npm install again, those .cmd files will reappear. Why doesn't npm download those files and stored it into node_modules folder?

When I clone the repo in another computer, it doesn't create those .cmd files. Both computer are running windows 10.

After several testing, I found out that if I delete package-lock.json file first then only perform npm install, then those .cmd won't appear, but then now the project fails to start.

screenshot of project root folder

screenshot of package.json file

like image 541
Andrew Lam Avatar asked Jun 02 '18 03:06

Andrew Lam


People also ask

Where do npm packages get installed?

Find the install path. The npm packages installed locally will always be installed on the node_modules/ folder right in your current working directory. For example, when you're on a directory called project/ from the terminal, then it will be inside the project/node_modules folder.

Where to put node_ modules?

Node Modules Packages are dropped into the node_modules folder under the prefix . When installing locally, this means that you can require("packagename") to load its main module, or require("packagename/lib/path/to/sub/module") to load other modules. Global installs on Unix systems go to {prefix}/lib/node_modules .

Where are npm files stored?

on windows: c/Program\ Files/nodejs/node_modules/npm/npmrc.

Do I have to run npm install for every project?

It is not necessary to do "npm install" each time you want to compile. You just need to do it when you change the dependencies of your project. Show activity on this post. NPM basically is the package manager for node.


1 Answers

This happened to me - the fix on Windows was to go to c:\Users\{username}\.npmrc and remove the prefix.

like image 200
Sean Chase Avatar answered Sep 18 '22 08:09

Sean Chase