I have a web application with some packages defined in package.json after I run npm install all dependencies are resolved. However when I add some packages after that to package.json and run npm install again nothing happens. I did the work around by typing npm install --save lodash and it downloaded the dependency and updated packages.json. It works, but let's imagine the scenario when I want to add 10 or more packages. Then it would be easier for me to just add them to package.json and run npm install but this does not work :/. So what would be the solution for the problem off adding more packages after initial npm install?
Node version: v8.1.3
npm version: 5.03
Operating System: Windows 10 Pro
Related
npm install #uiw/react-monacoeditor --save
VS
npm i #uiw/react-monacoeditor
What is the difference between following npm install statements when to use --save flag?
Currently they will not differ at all. Since NPM 5 packages are automatically saved into package.json dependencies when installed.
npm I is the short version of npm install so that part of the command does not differ at all either.
You can read more about the install command here: https://docs.npmjs.com/cli/v8/commands/npm-install
And there is does say “ npm install saves any specified packages into dependencies by default.”
I've already installed Node.js in my machine. When I try npm install, the installation does not properly work for me. I get the following on my console:
Installed node version 14.15.1
Installed npm version 6.14.8
Installed angular cli version 11.2.3
And then some errors pop up. Here's a screenshot of my console:
Any of the following methods might be useful for you:
Method 1: Clean cache & then perform an installation
npm cache clean --force
npm install
Method 2: Exclude package-lock.json file and perform an installation
npm install --no-package-lock
Method 3: Manually delete node_modules and package-lock.json file and then perform an installation
npm install
Q.1 if we use below command how many places will be affected in angular project
npm install bootstrap
Q.2 what is difference if we use above command with --save
npm install bootstrap --save
Q1. Running 'npm install bootstrap' command will download the latest version of bootstrap and install in subfolder './node_module' folder.
Q2. Running install --save bootstrap will do same as above but will update package.json by adding entry under dependencies.
Before npm 5.0.0 they were different but now there is no difference.
Before version 5.0.0
npm install bootstrap --save would download the latest version of bootstrap and add it to your dependencies in package.json file.
npm install bootstrap would download the latest version of bootstrap but it would not add it in dependencies in package.json file.
After version 5.0.0
there is no difference between both commands. As it was --save was made default so with or without --save it would add it in dependencies in package.json
In addition, there are the complementary options --save-dev and --save-optional which save the package under devDependencies and optionalDependencies, respectively. This is useful when installing development-only packages, like grunt or your testing library.
Upon reinstalling Windows 10 (and Node.js), the gulp command isn't found. I ran it from my root folder containing package.json and the node_modules folder. I tried npm install gulp, and also npm install: gulp command still not found. I'm a bit puzzled.
Any idea?
do you re install node and npm again? when you re install node try with npm install -g gulp
npm install -g gulp will install gulp globally, so that you can use it as a command.
A better way to do it, is to use npm install gulp (without the -g) to install it into each local project, and fire it off using npm start scripts in each project's package.json.
I have a React-Native project and I'm trying to install certain npm modules in my project.
However, when I try to do so from the command line, the packages says it is installed correctly, but it is not appearing in the packages.json dependency.
For instance, I installed react-relay using npm install react-relay.
The package looks to have installed correctly. But I check my packages.json and react-relay is not in there.
I have tried react-native link, and the packages are not coming up.
What is going on?
you would need to use the "save" option: npm install react-relay --save
You need to add save option
npm install react-relay --save
or
npm i react-relay --s
To remove node module from package.json file
npm uninstall react-relay --save
Here is documentation for npm install