How to install particular Angular version using node package manager - npm

How can install a specific version of Angular 4 using node package manager?
I ran npm view #angular/cli versions command , the available version displayed are
I could not see version 4 and 5 in the list
how could i download the version 4 or 5

If you want to install this specific version of the angular cli you have to use this command:
npm install -g #angular/cli#1.4.9
Perhaps you have an other version currently installed on your system you should read this also.
source: Angular downgrade from version 5 to 4

To install a particular version you need to run the following command line
npm install -g #angular/cli#<version>
Example:
npm install -g #angular/cli#1.0.0
You can see the available versions with the following command:
npm view #angular/cli

Related

pnpm uses old version of node

I am using nvm and I got node v14 installed and running node -v confirms that, but when I try to install a package in my project that requires the v14 engine pnpm tells me that I am currently using node v12 Unsupported engine: wanted: {"node":">=14.15"} (current: {"node":"v12.18.3","pnpm":"6.0.1"}) . This is the node version installed at /usr/bin/node but how do I tell it to use nvm version?
Pnpm supports the use-node-version parameter, that will download and use a specific version of node.
You should remove or update this settings from your .npmrc file.
We are experimenting with bundling pnpm with Node.js. The bundled version is currently published as a separate package, you may install it using one of the following scripts:
curl -f https://get.pnpm.io/v6.js | node - add --global #pnpm/beta
or using powershell:
(Invoke-WebRequest 'https://get.pnpm.io/v6.js' -UseBasicParsing).Content | node - add --global #pnpm/beta

How to Update Angular Cli

Just to give you some context.
I was running a project and after ng serve I was getting this warning message:
our global Angular CLI version (9.1.4) is greater than your local
version (1.0.0). The local Angular CLI version is used.
I googled and figured out I should update angular cli with the following command.
npm install --save -dev #angular/cli#latest
After that I am getting the following error when trying to build the project:
The build command requires to be run in an Angular project, but a project definition could not be found
Any help will be much appreciated.
After reading some issues reported on the GitHub repository, I found the solution.
In order to update the angular-cli package installed globally in your system, you need to run:
npm uninstall -g angular-cli
npm install -g #angular/cli#latest
Depending on your system, you may need to prefix the above commands with sudo.
Also, most likely you want to also update your local project version, because inside your project directory it will be selected with higher priority than the global one:
rm -rf node_modules
npm uninstall --save-dev angular-cli
npm install --save-dev #angular/cli#latest
npm install
After updating your CLI, you probably want to update your angular version too
Note: if you are updating to Angular CLI 6+ from an older version, you might need to read this
Edit: In addition, if you were still on a 1.x version of the cli, you need to convert your angular-cli.json to angular.json, which you can do with the following command:
ng update #angular/cli --from=1.7.4 --migrate-only
check here for more details.

You are running version v6.10.3 of Node.js, which is not supported by Angular CLI v6

I am having trouble with this error, my project need run angular/cli version 1.7.4 and Nodejs 6.10.3 .But the past I used angular cli version 6 and now I want to downgrade to angular cli 1.7.4 but I don't know how to downgrade angular cli version 6 at my global. I try to use npm uninstall -g #angular/cli and then I install the version I want by command npm install -g #angular/cli#1.7.4 but when I check ng -v it's still have a error in picture
P/S: I were updated my npm to latest version to make sure can remove angular cli version but still don't work
Keep your global package running at the highest version. If a project needs CLI 1.x, use the npm run commands instead.
Any npm commands run use the project's CLI, not your global version.

How to install beta version via npm

I need to install a beta version 3.0.0 of react-docgen.
Is it possible to install a beta version via npm?
Yes, it's possible to install a beta version using the # symbol. For example to install react-docgen (v3.0.0-beta7) run the following command:
npm install -g react-docgen#3.0.0-beta7
Further information about installing specific versions can be found in the npm-install documentation.
The syntax for npm install includes both of the following overloads:
npm install [<#scope>/]<name>#<tag>
npm install [<#scope>/]<name>#<version>
For tag, you can specify either #latest and #beta like this:
npm install #11ty/eleventy#latest # latest stable release
npm install #11ty/eleventy#beta # latest beta release
Interestingly, if you don't specify a tag, the default, set by your npm config, is #latest
You can also find out which versions are available by running npm view
npm view #11ty/eleventy
To install a specific beta version:
npm install -g react-docgen#3.0.0-beta7
//or
yarn global add react-docgen#3.0.0-beta7 // if you use yarn
P.S.:
In order to see all versions of a package (including alpha, beta , pre-release, release):
npm show <package> versions --json
Example:
npm show react-docgen versions --json
You can also install a certain version using a tag!
npm install <name>#<tag>
In order to see which tags are available for this package, you have to run:
npm view react-docgen
A tag can be used when installing packages as a reference to a version
instead of using a specific version number (alias)

Cannot uninstall ionic using npm on Mac

I am trying to switch to ionic2. Installing on top of my previous installation of ionic 1 appears to succeed (based on the output) but ionic1 remains as shown by ionic info. Here were the steps. Any help would be appreciated.
Successfully Installed ionic2#beta using sudo npm install -g ionic#beta
ionic -v shows version 1.7.14
Uninstalled using npm uninstall -g ionic
Successfully (based on printout) uninstalled ionic 2
ionic -v shows version 1.7.14 (WTF)
Tried 'npm uninstall -g ionic' again
Received command prompt immediately, no other outputs (no affect)
ionic -v shows version 1.7.14
With some investigation I found out what was going wrong. At some point earlier I had installed ionic version 1 which got loaded by npm in /usr/local/lib as part of the sub-directory node_modules. Later on when I installed version 2 globally with sudo it installed it in my home directory ~/.npm-global/lib/node_modules/ionic/bin. The installed program was a node script called ionic. The bash alias was still pointing to the version 1 code. I don't know why npm changed the directory. To fix the problem, I did the following:
Deleted the folder /usr/local/bin/node_modules/ionic
Removed the symbolic link to the alias named ionic
Re-installed the ionic#beta globally using sudo. This created the node script ionic in ~/.npm-global/lib/node_modules/ionic/bin.
Tested it using the full path to the node script ionic
In the process of creating a symbolic link named ionic so I can access the command from anywhere in my home directory.
Have to load cordova 4.3 and
I should have found this earlier but I am getting rusty in my command line skills. It turns out that ionic-cli is works for both v1 and v2.
You are using wrong command ionic2#beta to install ionic 2. Use
$ npm install -g ionic#beta
use this
sudo npm uninstall -g ionic
This works for me on ubuntu 16,
to remove cordova, ionic:
sudo npm uninstall -g cordova
sudo npm uninstall -g ionic
and for npm:
sudo npm uninstall npm -g
hope it will work
For mac user delete this folders.
/usr/local/lib/node_modules/ionic
/usr/local/share/npm/lib/node_modules/ionic
As you could install it with
npm install -g ionic
you should uninstall it with
npm uninstall -g ionic