I am looking for a way to upgrade my npm, I follow the option 3 for windows in here npm docs. but when I install it it said npm.exe already in nodejs folder. I try to overwrite it with --force but it still not overwritten. How to do it correctly? also how to update node?
This is the new best way to upgrade npm on Windows.
Run PowerShell as Administrator
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade
Note: Do not run npm i -g npm. Instead, use npm-windows-upgrade to update npm going forward. Also if you run the NodeJS installer, it will replace the node version.
Upgrades npm in-place, where node installed it.
Easy updating, update to the latest by running npm-windows-upgrade -p -v latest.
Does not modify the default path.
Does not change the default global package location.
Allows easy upgrades and downgrades.
Officially recommended by the NPM team.
A list of versions matched between NPM and NODE (https://nodejs.org/en/download/releases/) - but you will need to download NODE INSTALLER and run that to update node (https://nodejs.org/en/)
There is a tool, nvm, that solves your problem quite easly. There is also a Windows version, is not as cool as the linux/mac version but it works fine anyway
I suggest using option 1. Go to environment system variables and add "%appdata%\npm" to path like this: edit path
Then updated npm files should be loaded before those you installed with node
Node.js v16 or higher?
npm install -g npm
Node.js v14 or below?
Consider updating to latest LTS release of Node.js
npm-windows-upgrade
I want to start the server, but when I enter the command yarn run dev gives
Yarn requires Node.js 4.0 or higher to be installed.
I installed the latest available version of NodeJs, but nothing has changed. I also entered the command
npm install -g yarn, but nothing worked either. How else can you solve this problem?
If the NVM already installed, try at the terminal
$ source ~/.nvm/nvm.sh
Adonis command neither give error nor works
I just clone the Node project from one PC to another. Installed npm and adonis. Now my Node project is working when I open the URL at which it is serving it shows me the login page.
When in try to execute the Migration command, cli is neither executing the command nor giving any error.
Try to reinstall #adonisjs/cli :
Uninstall (Globally):
> npm uninstall -g #adonisjs/cli
Install (Globally):
> npm i -g #adonisjs/cli
#adonisjs/cli must be installed globally (it's not a project dependency)
Installation - AdonisJS documentation
I followed the documentation to create my first NestJS project.
Installing the Nest CLI with the command npm i -g #nestjs/cli was successful.
The output was:
+ #nestjs/cli#6.3.0
updated 1 package in 11.326s
However, when I try to scaffold a project with the Nest CLI:
nest new project-name
I get the following error:
zsh: command not found: nest
Some details about my environment:
OSX
iTerm
npm version 6.5.0
Use npx #nestjs/cli instead of nest
e.g. npx #nestjs/cli g controller pages
I was also getting the same console error when npm installing!
Erro was
#nestjs/cli
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/#nestjs/cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/#nestjs
npm WARN notsup Unsupported engine for watchpack-chokidar2#2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"12.14.1","npm":"6.13.4"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2#2.0.0
How I wasn able to install =>
Solution
sudo npm install -g #nestjs/cli
Following command works in my windows 10
node -v
v14.16.0
npm -v
6.14.11
npx #nestjs/cli new project-name
I was having the same issue, what I did was:
Installed the latest node with npm install npm#latest -g
and then added the following to my .bash_profile
alias nest="/usr/local/Cellar/node/11.9.0/bin/nest"
Tested with nest --version and it worked.
For some reason the path is not being called correctly, hope it helps.
Working through a NestJS/Mongo DB tutorial i stumbled into this very same problem. After trying all of the solutions that were listed above, even turning my default profile back to bash instead of using zsh, i found that simply adding the /usr/local/bin and ~/.npm-global/bin to my path variable resolved the issue. Hopefully this helps someone else who may stumble on this in the future as well.
export $PATH="/usr/local/bin"
export $PATH="~/.npm-global/bin"
Were the two commands i ran from iTerm2 in order to add them to my PATH environment variable. Once this was done a simple
env
showed the entries in my $PATH environment variable and the nest -v command worked without any issues.
I had same error when I use GitBash.
I resoved it:
If you use windows:
Your use CMD: npm i -g #nestjs/cli
Then you can use gitbash:
Check version nestjs: nest --version
Create app nestjs: nest new name_project
I have faced same problem and solved ,following this
write the command NPM root -g
check where NPM is installed
add it to your path environment variable
You have to add the following line to your ~/.zshrc file:
source $HOME/.bashrc
This is needed so that the npm binaries are available on startup.
After all the answers that I tried, I used my method
After installing npm i -g #nestjs/cli in my mac terminal.
open bash file in macos by typing open ~/.bash_profile in mac terminal. Like you can type it anywhere.
Your bash will look like this and use this line
alias nest="~/.npm-global/lib/node_modules/#nestjs/cli/bin/nest.js"
Restart your mac for changes to be reflected in your terminal.
There you go nestjs cli is now working globally 2nd screenshot.
I have just succeeded with
npx #nets/cli new project
when asked what manager to choose from npm / yarn / pnpm
made choice for pnpm
cd project
npm run start
Take care!
Must use sudo in comandline for linux, otherwise the command nest cannot be add to /usr/local/bin folder:
sudo npm install -g #nestjs/cli
You can try to use sudo
sudo yarn global add #nestjs/cli
I got the same issue.
I just uninstalled and reinstalled nextjs.
Finally, I can use next -v
this is my first electron js installation, and I had to download and install its electron, NPM install (in the folder electron), but when at the start, failed.
error on print, or if I had to do python downgrade?
My error screenshot:
Make sure that you are writing python3 style code. Like when you write print It should be print(...)
I had a similar problem when installing on windows. Possible solutions:
First check the versions od npm and node, update it with this commands:
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash
Install again node:
sudo apt-get install nodejs
And update:
npm update -g
If it doesn't work try to update or reinstall Phyton an put it in global environment variables path.
Check the electron git and try to download the last version manually.
Other solutions:
Install or reinstall Windows .Net.
Install or reinstall Visual Basic c++
Update the package dependencies of the node