Installing #angular/cli at version 9 but then reporting version 7 - javascript

I am trying to update my global version of angular/cli to version 9, but after running the steps below I am still seeing version 7 installed.
Step 1
npm uninstall -g #angular/cli
Step 2
npm cache clean --force
also tried
npm cache verify
Step 3
npm install -g #angular/cli#latest
It uninstalls fine as when I run ng --version after the uninstall I do not see version of CLI installed. Yet, running this again after step 3 I see version 7 installed.

You have updated it globally. Have you tried removing node_modules in project folder ?
rm -rf node_modules
npm uninstall --save-dev angular-cli
npm install --save-dev #angular/cli#latest
npm install

Related

Eslint uninstall

I uninstall eslint from my system by running two commands i.e
npm uninstall eslint --save-dev (to remove it from the package .json)
npm uninstall eslint
But after doing all this when I run this command npm eslint -v, it shows me the version of the eslint.
How do I completely remove eslint from my system?
Try to check globally installed packages using the below command:
npm list -g
And if you find eslint in the list then try to use this command:
npm uninstall -g eslint --save
checkout this link if this didn't work: https://www.codegrepper.com/code-examples/javascript/how+to+uninstall+eslint

How to upgrade electron to latest version?

Whats the best way to upgrade to the latest version of electron?
Should I be concerned about any problems caused by upgrading?
I’m playing around with “electron”: “^1.7.9”, and “react”: “^16.1.1”, on linux.
I’m using yarn, not npm;
The app I’m playing around with has never been ejected, so the assumed config is intact.
The codebase I'm using is here:
https://github.com/csepulv/electron-with-create-react-app
To upgrade the node library to the latest version and for electron in this instance you should use:
npm install electron#latest
What if electron forge is not compatible with node js?
You need to update everything with the latest version.
## update electron
# 1. Check node version or if use nvm auto script -> nvm ls
node -v
# 2. clean cache
npm cache clean -f
# 3. Download and install from here https://nodejs.org/en/download/
# 4. install node version n Latest LTS Version: 16.15.0 (includes npm 8.5.5)
# Install n globally
# or --> npm install -g npm stable
npm install -g n latest
# 5
npm install -g npm
# 6 Then update node or npm install -g n
npm install -g node
# 7 update node and npm in one command o
npm install -g npm#latest
# 7. Update electron or
# https://www.electronjs.org/docs/latest/tutorial/updates#:~:text=The%20easiest%20way%20to%20use,with%20update.electronjs.org.&text=By%20default%2C%20this%20module%20will,be%20downloaded%20in%20the%20background.
npm install electron#latest
npm install update-electron-app
# 8. check node version and electron version
# 9. Restart computer
## end update electron

Unable to upgrade npm to npm#latest Mac [duplicate]

This question already has answers here:
How can I update NodeJS and NPM to their latest versions?
(64 answers)
Closed 4 years ago.
I'm on MacBook Air HighSierra v10.13.4.
I installed node from https://nodejs.org/ and it gave me npm#5.6.0.
I want to upgrade npm to the current lastest version.
So I've tired npm i npm#latest -g , npm i npm -g and sudo npm i npm -g.
It returns
/Users/sandeep/.npm-global/bin/npm -> /Users/sandeep/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/Users/sandeep/.npm-global/bin/npx -> /Users/sandeep/.npm-global/lib/node_modules/npm/bin/npx-cli.js
+ npm#6.4.0
updated 1 package in 12.452s
But no good when I run npm -v it returns me 5.6.0.
But when i run npm list --depth=0 -g it shows npm#6.4.0.
Can someone pls help me with this ?
I will suggest you download macOS Installer node-v8.11.4.pkg and use your installer to install it.
Node: On default Latest LTS Version: 8.11.4 (includes npm 5.6.0)
After you install the default 8.11.4, run:
npm install -g npm
This should update you to the most recent version of npm.
I hope this helps.
You can upgrade to the latest version of npm using:
npm install -g npm#latest
Or upgrade to the most recent release:
npm install -g npm#next
You may need to prefix these commands with sudo, especially on Linux, or OS X if you installed Node using its default installer.

Node update a specific package

I want to update my Browser-sync without updating all my node packages. How can I achieve this? My current version of Browser-sync does not have the Browser-sync GUI :(
├─┬ browser-sync#1.9.2
│ ├── browser-sync-client#1.0.2
Most of the time you can just npm update (or pnpm update or yarn upgrade) a module to get the latest non breaking changes (respecting the semver specified in your package.json) (<-- read that last part again).
npm update browser-sync
-------
pnpm update browser-sync
-------
yarn upgrade browser-sync
Use [p]npm|yarn outdated to see which modules have newer versions
Use [p]npm update|yarn upgrade (without a package name) to update all modules
Major version upgrades:
In your case, it looks like you want the next major version (v2.x.x), which is likely to have breaking changes and you will need to update your app to accommodate those changes. You can install/save the latest 2.x.x by doing:
npm install browser-sync#2 --save-dev
-------
pnpm add browser-sync#2 --save-dev
-------
yarn add browser-sync#2 --dev
...or the latest 2.1.x by doing:
npm install browser-sync#2.1 --save-dev
-------
pnpm add browser-sync#2.1 --save-dev
-------
yarn add browser-sync#2.1 --dev
...or the latest and greatest by doing:
npm install browser-sync#latest --save-dev
-------
pnpm add browser-sync#latest --save-dev
-------
yarn add browser-sync#latest --dev
Note: the last one is no different than doing uninstall followed by install like this:
npm uninstall browser-sync --save-dev
npm install browser-sync --save-dev
-------
pnpm remove browser-sync --save-dev
pnpm add browser-sync --save-dev
-------
yarn remove browser-sync --dev
yarn add browser-sync --dev
The --save-dev part is important. This will uninstall it, remove the value from your package.json, and then reinstall the latest version and save the new value to your package.json.
Use npm outdated to see Current and Latest version of all packages.
Then npm i packageName#versionNumber to install specific version : example npm i browser-sync#2.1.0.
Or npm i packageName#latest to install latest version : example npm i browser-sync#latest.
NPM
Update Specific Package to the Latest Version:
npm update browser-sync
Update a Package By Version:
npm view browser-sync versions (view package version)
npm install browser-sync#2
Update all packages to the latest versions:
npm outdated (this checks the registry to see if any installed packages are currently outdated)
npm update --save/--save-dev (updates and saves dependencies in package.json)
Run a security audit for all the packages:
npm audit (submits a description of the dependencies configured in your project to your default registry and asks for a report of known vulnerabilities)
npm audit fix (fix vulnerabilities)
Yarn
Updates all packages to the latest version:
yarn upgrade
Updates specific package to the latest version:
yarn upgrade browser-sync
Updates specific package to specific version:
yarn upgrade browser-sync#^2
Pnpm
Updates all dependencies, adhering to ranges specified in package.json:
pnpm up (alias of pnpm update)
Updates all dependencies, ignoring ranges specified in package.json:
pnpm up --latest
Updates browser-sync to the latest version on v2:
pnpm up browser-sync#2
Updates all dependencies under the #babel scope:
pnpm up "#babel/*"
The legacy-peer-deps command can be helpful as well, especially if you're dealing with some dependency issues and whatnot.
Example:
If the package is ngx-multi-window and it's on version 0.3.1
You would run: npm install ngx-multi-window#0.3.2 --legacy-peer-deps

Installing Angular-CLI on Windows 10

I had installation issues of angular-cli on Windows 10 system.
The errors were related to Python dependencies and node-gyp. Something as below :
>execSync#1.0.2 install C:\Users\UserName\AppData\Roaming\npm\node_modules\angular-cli\node_modules\execSync
node install.js
[execsync v1.0.2] Attempting to compile native extensions.
{ Error: spawn node-gyp ENOENT
at exports._errnoException (util.js:1007:11)
Update
this seems to be fixed in newer releases and this solution is no longer required.
mukesh51 eventually solved the problem.
the installation seems to work in these steps:
npm install -g node-gyp
npm install -g windows-build-tools
npm install -g #angular/cli
I took these steps from here.
Uninstall
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
Update Global package
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#latest
I too faced the same issue initially when I installed angular directly using bash. The installation was error completely. Then I attempted to install locally in my project (without removing the global one). That appeared to have solved the problem but got an error on creating a new app.
So i uninstalled everything :
npm uninstall -g #angular/cli
and the reinstalled Angular using Windows Power Shell(as Admin)
npm install -g #angular/cli
This solved the entire problem! Hope it helps!
Use windows power shell to install angular-cli. It will run without any issues.
Windows 10 Solution
Look back at the trace of installation steps ... you may see that it found the Angular binary in the following location:
C:\Program Files\Git\usr\local\node_modules\#angular\cli\bin
I added an ENVT variable using this path and ng worked fine after that
I tried using npm install -g #angular/cli
npm downloaded files successfully and copied files to AppData but not able to use ng -v
After that, I tried following:
npm cache clean --force
Removes npm cache forcefully if you get warning using npm cache clean.
Then try
npm install -g #angular/cli#latest
I have successfully installed by trying the above solution in Windows10.
Both the CLI and generated project have dependencies that require Node 8.9 or higher, together with NPM 5.5.1 or higher.
try update node.js and npm
npm uninstall -g #angular/cli
npm install -g #angular/cli
if doesn't work:
Close the terminal, open a new one or use CMD or Git for windows instead.

Categories

Resources