How to "npm install" only when the package being installed is not current - npm

How can I make so npm install package will only install the package if there is a newer package in the npm registry.
I mean that it won't even check the dependencies but only the main package I want.

npm update package should do this.

Related

What is the difference between the following npm install statements?

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.”

How do I apply changes in package-lock and package json?

I manually changed my dependencies in package-lock.json and package.json files. How do I now apply those changes to my node-modules without updating/touching other dependencies?
Run command
npm i
or
npm install --save
npm i command will install all your dependencies into your local machine which are available in the file.
PS: It is not recommended approach to directly update package.json file, always install package using command npm i packageName --save or npm i packageName --save --dev. This will install as well as Update your package.json file too.

npm does not install new package after modifying package.json

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

how to update package.json after npm installl in a package

I'm writing a npm package, I'd like the package to update package.json file in the installed folder, say:
npm install mypackage
this installs mypackage, and also read the package.json in the folder where npm install is run, and write some entries, possible?
Thanks,
npm i -g npm-check-updates
npm-check-updates -u
npm install
or for a specific package, you may change dependency version and then
npm update --save

npm packages installed from command line not appearing in packages.json dependencies for React-Native project

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