Sorry for such a trivial question, but I'm new to node.
So can one install a package using only the npms package.json file? If yes how can we achieve this? I know I could install it using npm install packageName command, but my project is running on windows azure mobile service and it just allows to modify the package.json file and not to run the npm commands.
So if this is possible, then where do I specify the package name to load and install in the package.json file?
Here is an example of using package.json, imagine you want to add package express as dependency:
{
"name": "TAP",
"description": "Simple package by TAP",
"author": "The amateur programmer",
"dependencies": {
"express": ">= 1.2.0"
}
}
After making changes to the package.json, you need to run npm install command for changes to take effect.
For more information, please refer to the Documentation.
you will get dependencies & devDependencies fields in package.json file, modify them accordingly.
Let's assume you have following content in package.json.
{
"name": "node-app",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "~4.2.0"
}
If you want to add underscore as dependency modify dependencies add another key as package-name
{
"name": "node-app",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "~4.2.0",
"underscore" : "~1.0"
}
But make sure adding ,(commas) properly.