简体   繁体   English

通过运行npm install create-react-app创建的node_modules文件夹有什么用?

[英]What for is the node_modules folder that is created by running npm install create-react-app for?

When I run npm install create-react-app in any folder, it creates a node_modules folder. 当我在任何文件夹中运行npm install create-react-app时,它将创建一个node_modules文件夹。 What is the node_modules folder for? node_modules文件夹有什么用? How is it related to create-react-app ? 它与create-react-app什么关系?

create-react-app should be installed using npm install -g create-react-app that will make the create-react-app command available in any directory. create-react-app应使用安装npm install -g create-react-app ,这将使create-react-app的任何目录中可用的命令。

See the npm documentation for a complete description of the various folders that npm creates or writes to. 有关npm创建或写入的各种文件夹的完整说明,请参见npm文档

Whe you run npm install create-react-app (without the global ( -g ) modifier) npm executes a local dependency install and puts the results in ./node_modules of the current directory. 运行npm install create-react-app (不带全局( -g )修饰符)时,npm执行本地依赖项安装,并将结果./node_modules当前目录的./node_modules中。

如果要避免创建node_modules目录,可以通过npm install -g create-react-app全局npm install -g create-react-app

Short answer: yes. 简短的回答:是的。

Long answer: create-react-app should be installed globally, then run inside the folder in which you wish to put your app. 长答案: create-react-app应该在全局安装,然后在要放置应用程序的文件夹中运行。

基本上是包含您的应用程序所需的所有节点程序包的文件夹,nmp install create-react-app依赖于将安装在node_modules文件夹中的其他节点程序包。

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

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