This may be a silly question but I have installed node on my computer and have been running tasks for creating my sass which means I have a node_modules folder within my project folder and I'm wondering if I need to upload the node_modules folder to my live server or not?
Tipically you must:
To have installed Node.js in the server (and npm).
You generate packaje.json in local. npm init. You execute this in a folder containing node_modules.
When package.json is generated. You upload it to the server.
When package.json is in the server, specifically in your project folder, you install all dependencies with npm install
You should make sure that your server had installed node.js if you want to run node.js project on your server and you can use 'npm install' to install the modulars of the package.json.
Related
I am trying to do an NPM build, install and bundle on a server which does not have a network connection
I can run the build successfully on an online server, and I can copy the directories which are required over to the offline server
How can I reproduce the NPM environment on the offline server so that an an NPM build, install and bundle will be successful?
I assume I should be copying the node_modules and package-lock.json and running an npm install --offline.
I can run the build successfully on an online server, and I can copy the directories which are required over to the offline server
Knowing that, on a system that has access to the internet, run npm install to create and populate the node_modules directory with all the dependencies.
Copy over the entire application directory including node_modules directory, allowing all dependencies available to the offline server.
This is the approach shared in comments: How to install npm package while offline?
If the dependencies need to be updated, these steps would need to be repeated.
I failed to make my node app work in WinSCP. To my understanding, node version 6 is installed on the server, while my node version is at at 8+. Does it matter? I also got e.g. express, mongoose and handlebars in my app. Do I need to add those in the server as well?
What are the proper steps to upload a node app?
On the server, you should have node install the app. This way node will download and install the files/libraries that are required in your package.json file on the server.
try this.
Upload your project to the server and change to the directory of your project. if node_modules exists delete the folder then run.
npm install
This should create a node_module folder and install all the requirements.
Once the install is complete you should be able to run your app with.
npm start
My development machine has no internet connection and I want to install gulp on my project:
npm install -g gulp
On my machine with internet connection I don't have right to install any piece of software (node or npm).
There is a way to download gulp package (like I do for nuget packages) and to install it to my project?
When installing npm modules globally, they are by default saved to
C:\Users\{User}\AppData\Roaming\npm
You need to download the modules and manually place them in that folder, and make sure that the path has been added to Path environment variable on your computer.
Since you are not able to download them through npm, simply go to the gulp github repository, and place the content of that repository in a folder named gulp, in the path above.
npm install -g gulp
in your project directory use
npm link gulp
this will create shortcut of gulp module in node_modules so that you don't have to download it, make sure to upvote.
I've recently upgraded my netcoreapp1.0 to netcoreapp1.1. This left me wit ha few surprises and error that needed to be fixed. On top of that, I recently got a new PC, which forced me to go through even more things.
First up I had to install NodeJS again, and from the node package manager, install bower. After installing both NodeJS and bower, and several hours after working on my project, I realized, as I had to commit the changes to remote source control, that a node_modules folder had appeared (though hidden) in my project. Git of course wants to commit this folder, but I'd rather not since it contains loads of subfolders and other items.
I was wondering what to do with this folder. I believe it shouldn't be there? And I'm not sure why it is. Shouldn't it be global or something, specific from PC to PC? Or should I just add it to my .gitignore file?
Quick info: It wasn't there prior to the upgraded project, meaning that I couldn't see any node_modules folder in netcoreapp1.0 and there's no folder in my source control?
This node_modules folder wasn't there before because before it was installed globally:
npm install -g bower
the advantages of globally installing bower is that you can use the bower command through the command-line directly.
now apparently bower was installed locally, with the following command:
npm install bower
Now it was locally installed in the node_modules folder, meaning this folder appeared.
You don't need to check this folder into get and you can simple add the following rule in your .gitignore file:
node_modules
But 1 thing to remember! when you build your application with teamcity or some other CI build tool you will now need to install npm packages (just run npm install in the folder) before you publish your application, otherwise these javascript files will be missing.
I am rather new to Node but am working on a project behind a very restrictive firewall so I cannot use npm to install packages (no proxy either). I am trying to use express and have been able to include it by just storing the files locally and requiring the local file path but I do not know how to structure the project so that node can find and include all of the dependencies for express (which I also have manually downloaded from github and stored locally within the project). Does anyone know how to do a completely manual global or local install of individual node dependency packages?
Simply download the files and place them in a 'node_modules' folder in the root of your app. Then use 'npm init' to create a package.json. Add your dependencies in the dependencies list in that file.
Then run simply 'npm install'.