Failure to install packages after setting yarn to package manager - npm

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

Related

Can I run npm package using yarn without installing that package?

Using npm you can use not locally installed package (missing in local node_modules) like this
npx #angular/cli ng new
which will install cli to the cache and use it (node_modules in project are intact)
can I do this with yarn ??

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

npm install result in an incomplete module, but yarn install is successful, why they behave differently?

I tried npm install and npm install --no-optional for my forked repository, and it was not installed completely: git+https://github.com/marsonmao/react-sketch#v0.4.104 (link).
After using npm install, only part of the repository was installed: there are only /node_modules and .eslintrc, karma.config.js, README.md...etc in MyProject/node_modules/react-sketch, but no /lib and /src...etc.
Then I tried yarn install and it was successful, every file in the repository was installed.
So why npm failed however yarn succeeded?
npm version: 5.5.1, yarn version: 1.3.2

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

Installing/Using Bower on Uberspace with NPM

Hi I use uberspace and installed ghost there. Ghost uses npm.
If I try:
npm install -g bower
It doesn't install it and throws a lot of erros messages what makes sense because the server is shared between many users.
sudo npm install -g bower
Tells me that it doesn't know bower
If I install it locally with
npm install bower
It installs it to ../node_modules. But using for example
bower install angular-mailchimp
Throws the error:
-bash: bower: command not found
How do I get it running?
I was able to get Bower installed in the correct place by prefixing the global install with the following command.
npm install -g --prefix=$HOME bower