I am making a web page, node_modules
file is around 150 megabytes, should I upload it or not? Is there any way to make it smaller? I am using "filezilla" and it would take too long to upload it.
I am making a web page, node_modules
file is around 150 megabytes, should I upload it or not? Is there any way to make it smaller? I am using "filezilla" and it would take too long to upload it.
-
8
No you should not .The size of node_module will be pretty big rather uploading
package.json
file will be enough – brk Commented Aug 29, 2018 at 14:04 -
if case of git,
node_modules
are kept undergitignore
, and dependencies track is done usingpackage.json
file – Abhishek Kumar Commented Aug 29, 2018 at 14:07 -
you should have a
package.json
with the list of dependencies and runnpm install
on the server -- this will generate thenode_modules
folder on the server. – João Neto Commented Aug 29, 2018 at 14:19
2 Answers
Reset to default 8Node 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.
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. Then, in your server, simple run npm i
before running the application.
If you have a package.json
file and used npm module -s <package_name>
(with -s or --save) then everything was fine.
If you don't have it no worries.Transfer the files into your online services like AWS,Something like that.
Then give the mands.
// 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.
No need to copy the node_modules folder at all.