Abandoned question: Why does 'npm install' remove my packages? - npm

The command is npm install --save file-saver and it returns this:
npm WARN The package enzyme is included as both a dev and production dependency.
npm WARN The package gulp-util is included as both a dev and production dependency.
npm WARN The package react-addons-test-utils is included as both a dev and production dependency.
+file-saver#1.3.3
added 1 package and removed 15 packages in 6.536s
I know two of the packages removed are react-google-recaptcha and react-async-script. Also, I'm not using npm's public registry.

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 to add npm module without changing old dependencies in package-lock.json?

I use npm ci to install npm modules and it install same package versions as in package-lock.json
And now I need to add npm module for starting write unit tests, I use this command: npm i jest
I expect that it should add only jest dependencies, but npm update all out-of-date dependencies of 3-5 level dependencies in package-lock.json
I would like to do something like this npm ci --save-dev jest
How to install npm package without changing old dependencies in package-lock.json?
UPD For example, please clone this repo, after that use npm ci and npm i empty-module, if you look at git diff you'll see a lot of changes of package-lock.json file

npm failing to install packages with local dependency

I am having problems installing an npm package that has a file dependency off of github. When installing directly from a local package there are no problems.
The package that I am trying to install has a dependency on a package defined within on of its subdirectories.
The error I am getting is as follows:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "node_modules/local-dependency-example/local-dependency" as it does not contain a package.json file.
I created the following package in order to reproduce: https://github.com/eladzlot/local-dependency-example
In order to reproduce you should create an empty package: npm init.
Then attempt to install: npm install eladzlot/local-dependency-example --save.
This problem occurs both with npm v3.10.10 and npm v5.5.1

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

Failure to install packages after setting yarn to package manager

Im trying to setup a new project with angular cli and have set my package manger like this:
ng set --global packageManager=yarn
However, when I try to create a new angular project with cli, I get this
Installing packages for tooling via yarn.
'yarn' is not recognized as an internal or external command,
operable program or batch file.
Package install failed, see above.
Package install failed, see above.
So then I start looking to see if I have yarn even installed and I do this:
D:\devsrc>npm list -g --depth=0
and get this:
C:\Users\me\AppData\Roaming\npm
+-- #angular/cli#1.3.1
+-- angular-cli#1.0.0-beta.28.3
`-- typescript#2.2.2
npm ERR! peer dep missing: rxjs#^5.0.1, required by #angular/core#2.4.10
npm ERR! extraneous: tsickle#0.2.5 C:\Users\
How can I have 2 different versions of angular cli installed?
How can I clean this up and get Yarn installed?
So first thing, you are getting 'yarn' is not recognized as an internal or external command error is because you do not have yarn globally installed run
npm install yarn -g to fix that
Second you have two #angular/cli#1.3.1 and angular-cli#1.0.0-beta.28.3 packages is because the angular cli package name has being changed since version 1.0.0-beta.28.3. Before it was angular-cli now it is #angular/cli so just uninstall the old one uninstall angular-cli -g. After that you might need to reinstall the latest one npm install #angular/cli -g