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

不想你离开。 提交于 2020-02-20 07:22:08

问题


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.


回答1:


If this is only reproducible when using prefix then it is very possible that it is a bug in npm (there is a similar issue in pnpm that I was going to fix).

There is no workaround to this at the moment. There are no configs to set the bin location. So you should avoid using the prefix config until npm fixes the issue.




回答2:


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




回答3:


The problem is solved when I run npm install directly in the folder instead of using npm install --prefix.

This was extracted from the question post and moved here on the author's behalf.



来源:https://stackoverflow.com/questions/50653324/why-does-npm-install-a-bunch-of-cmd-files-on-my-project-root-folder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!