简体   繁体   English

如何将节点模块安装到项目文件夹之外的文件夹中?

[英]How to install node modules to a folder outside the project folder?

I am running a React project and npm install installs all of the modules in the root folder of the project, in which it creates around 30 000 new files, which then slows dows web cloud syncing (I am unable to exclude locations).我正在运行一个 React 项目, npm install将所有模块安装在项目的根文件夹中,它会在其中创建大约 30 000 个新文件,这会减慢 dows web 云同步(我无法排除位置)。 How can I install this large directory at a different location, that is outside the project folder or maybe globally somehow?如何将这个大目录安装在不同的位置,即项目文件夹之外或者可能以某种方式全局安装?

I have tried npm install -g after deleting the node_modules folder, but that said that everything is up to date and npm list -g shows only one item, that is the project.我试过npm install -g删除 node_modules 文件夹后,但说一切都是最新的, npm list -g只显示一项,即项目。 After that running npm start does not work, gives error 'react-scripts' is not recognized as an internal or external command之后运行npm start不起作用,给出错误'react-scripts' is not recognized as an internal or external command

Learn Next JS and try to make server side rendering学习Next JS ,尝试做服务端渲染

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM