Warn when install Angular cli via npm in global scope - node.js

I’m using 9.6.1 version of node, it goes with 5.6.0 version of npm.
I’m trying to install Angular with follow command:
$ npm i --no-optional -g #angular/cli
But is returned the follow message: npm WARN sass-loader#6.0.6 requires a peer of node-sass#^4.0.0 but none is installed. You must install peer dependencies yourself.
I have installing node-sass like this:
$ npm i --no-optional -g node-sass#^4.0.0
And it installs well.
So I run $ npm i --no-optional -g #angular/cli again, but the warning continues.
If I installing without -g flag, everything happens well, but I need to install globally to use ng command.

Related

how to uninstall a package that was installed with --save keyword

I'm working on a react js project with this spec:
node -v --> v16.15.1
npm -v --> 8.11.0
I usually install packages with npm install package-name --legacy-peer-deps and uninstall it with npm uninstall package-name --legacy-peer-deps which usually works fine.. but in one of the recent package I installed, I copied the command from the website and I remember there was --save keyword in it. now I want to uninstall it since I don't use it anymore so I ran this commands:
npm uninstall package-name --legacy-peer-deps
npm uninstall package-name --save --legacy-peer-deps
but the package name is still in the package.json file. what should I do to completely remove the package from my react js appliation?
remove it from your package.json and run npm install

Npm always showing me npm ERR! when I try to install anything

Please I need your help whenever I try to install anything with npm I always get errors please help me.
Update
From what read from the docs you should install the #ionic/cli
$ npm install -g #ionic/cli
From the docs:
If there was a previous installation of the Ionic CLI, it will need to be uninstalled due to a change in package name.
$ npm uninstall -g ionic
$ npm install -g #ionic/cli
You may want to add debug info while installing e.g.:
$ npm install -dd -g #ionic/cli
From your screenshot not sure if there is an error with your GIT config, or permissions to install the ionic cli globally on your machine...
Outdated
There should not be a space between ionic and #4, you should run e.g.:
npm install -g ionic#4
You can try with command like this npm install -g ionic#{{version}}.
In the place of version you should put your prefered version.

No valid versions available for undefined when running npm install -g #angular/cli

Running Windows 10 Enterprise.
I am trying to install angular cli to run the angular project. I entered below command.
--> npm install -g #angular/cli
I m getting below error.
--> npm ERR! code ENOVERSIONS
--> npm ERR! No valid versions available for undefined
what am i doing wrong
Seems to be you have to uninstall the node version and have to install it again
In order to run the npm install -g #angular/cli You need to have the node installed. Please find the below link to install the relevent node version for your PC. And try running the npm install -g #angular/cli command again.
Download the Node.js
Please make sure old node_modules are completely deleted and package-lock.json . Try fresh npm install now
rm package-lock.json
rm -rf node_modules
npm install

How to install gatsby?

When I try to install gatsby running npm install gatsby-cli -g , it shows that is successfuly installed but it does not work when I run gatsby --help oder gatsby -- build .... , it shows:
-bash: gatsby: command not found
the reason you are getting that is that you haven't installed it globally
$ npm i -g gatsby
$ source ~/.bashrc
source will refresh your terminal so you don't need to close it and open it up again
cli commands only work with globally installed packages
The Gatsby CLI is available via npm and should be installed globally by running:
npm install -g gatsby-cli
If you are unable to successfully run the Gatsby CLI due to a permissions issue, you may want to check out the npm docs on fixing permissions.
global flag -g comes first while installing any package
instead of npm install gatsby-cli -g run npm i -g gatsby-cli
any of below will work
npm install --global <package_name_to_install>
npm install -g <package_name_to_install>
npm i --global <package_name_to_install>
npm i -g <package_name_to_install>
for you package_name_to_install is gatsby-cli

Local grunt installation gives error

npm install -g grunt-cli //done successfully
npm install grunt --save --only=dev
gives following error
(node:11000) fs: re-evaluating native module sources is not supported. If
you are using the graceful
-fs module, please update it to a more recent version.
npm WARN prefer global coffee-script#1.10.0 should be installed with -g
project#1.0.0 C:\Users\Live\Desktop\node grunt\final
`-- (empty)
npm WARN project#1.0.0 No repository field.
npm ERR! code 1
Tried uninstalling grunt-cli, cleaning npm cache, then re-installing, but still the problem persists.
Ok short recap:
When in doubt remove your node_modules and install all packages again using npm install
If that didn't work, try updating your npm by executing npm update -g npm and redo step 1.
If that didn't solve your problem, try upgrading to another NodeJS version using nvm or n.

Resources