简体   繁体   English

我应该上传“ node_modules”吗?

[英]Should I upload “node_modules”?

I am making a web page, node_modules file is around 150 megabytes, should I upload it or not? 我正在制作一个网页, node_modules文件约为150 MB,是否应该上传? Is there any way to make it smaller? 有什么办法可以缩小尺寸? I am using "filezilla" and it would take too long to upload it. 我正在使用“ filezilla”,上传它会花费太长时间。

Node modules is where all the external libraries you use for your application are kept. 节点模块是您用于应用程序的所有外部库的保留位置。 The list of those libraries should be mentioned in package.json file. 这些库的列表应在package.json文件中提及。

You should, typically, not upload node modules folder manually. 通常,您不应该手动上传节点模块文件夹。 They are the external libraries and are easily available to install separately. 它们是外部库,可以轻松地单独安装。 So, when moving files through filezilla, move everything but node modules. 因此,当通过filezilla移动文件时,除了节点模块以外的所有东西都将移动。 Then, in your server, simple run npm i before running the application. 然后,在您的服务器中,简单运行npm i然后再运行该应用程序。

If you have a package.json file and used npm module -s <package_name> (with -s or --save) then everything was fine. 如果您有一个package.json文件,并且使用了npm module -s <package_name> (带有-s或--save),那么一切都很好。

If you don't have it no worries.Transfer the files into your online services like AWS,Something like that. 如果您不担心,将文件传输到您的在线服务(例如AWS)中,就是这样。

Then give the commands. 然后给出命令。

// For install npm

  npm i
    (or) 
  npm install

// To start your server

  npm start 

Whatever you put in your package.json file Start Object the file will be triggered. 无论您将其放在package.json文件的Start Object中如何,都会触发该文件。

No need to copy the node_modules folder at all. 完全不需要复制node_modules文件夹。

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

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