npx create-react-app -> The engine "node" is incompatible with this module. Expected version ">= 10.x". Got "8.16.0" - Arch Linux - node.js

I know this has been here many times, but it just doesn't work. I use Arch Linux. Everytime I try to run
npx create-react-app my-app
or
npm create-react-app my-app
I get
error #pmmmwh/react-refresh-webpack-plugin#0.4.3: The engine "node" is incompatible with
this module. Expected version ">= 10.x". Got "8.16.0"
error Found incompatible module.
When I type node -v I get 14.16.1 and npm -v -> 7.10.0
Looks like the node version doesn't appear update to 14.x version. Maybe?
I have tried updating sudo npm install -g npm and sudo n stable.
When I try sudo npm install npm#latest -g I get a lot of Missing write access to /usr/local/lib/node_modules/.............

The fix was that I had installed node via pacman and via Snap Store (I didn't know about it) and I saw in WebStorm that there is some node v 8.16.0 installed. So i uninstalled the snap version and it's working. Looks like create-react-app was using the snap version

Related

Error npm is known not to run on Node.js v10.24.1 and how to fix it, don't update to the latest version?

I run : npm run dev
Error : npm is known not to run on Node.js v10.24.1
I have researched and know the command: npm install -g npm#latest and some other commands to fix the problem
But the problem is that my project is using nodejs 10 so it can't use the latest nodejs. So is there any way to fix the above error. Thank you
UPDATE :
I use nvm to install and manage versions of nodejs. And my OS is macOs
The problem for me was upgrading my global version of npm while on an incompatible version of Node (8.16.1).
I tried to uninstall npm globally but that also didn't work because I could not use the npm command.
To fix it, I used nvm to switch to a compatible version of Node (nvm use 14.0.0 - this can be any version of Node compatible with the npm version you have installed globally). This allowed me to run npm commands so I ran npm uninstall -g npm first of all to remove my global version of npm and then nvm uninstall 8.16.1 to remove my faulty Node version.
I was then able to reinstall Node 8.16.1 (nvm install 8.16.1), and with it came a fresh install of a compatible npm version.
I happen to work on a project that builds on node 10 as well.
More details would have been helpful to understand the problem better but I suspect it's a compatibility issue.
Try these:
Download and install the latest version of nodejs.
Open you terminal and verify you have the latest version using node -v. Verify your npm version too using npm -v.
Since you have nvm installed, run nvm install 10, then nvm use 10.
Verify your versions again. In my case, node is v10.24.1 & npm is 6.14.12.
Start your app using npm run dev. Please check you package.json to be sure you are using the right startup command.
I was having the same problem, I ran the command and it solved the problem with NPM
sudo n latest
Node: v10.19.0
NPM: 8.9.0
Reference
I performed an upgrade of npm by mistake and run into the same issue.
The only way to solve for me was to delete the two following directories:
C:\Users\<username>\AppData\Roaming\npm
C:\Users\<username>\AppData\Roaming\npm-cache
npm is known not to run on Node.js v10.24.1 comes when normally people upgrade the version of npm to latest or recent ones, but when it comes to node 10 version you can use npm version 6.4.1 or 6 series. Normally npm 6.4.1 will come with node js 10.24.1 but if you have given any npm update cmd you need to go to C:\Users\username\AppData\Roaming and delete npm and npm cache folders then delete npm folders in C:\Users\username\AppData\local then check the npm version using npm -v. After doing this install the angular version
Thanks #Oduola Olumide Sunday for the response. I have followed your way but still not solved the problem.
And I fix it by removing the latest nodejs version and using the normal node v10.24.1
enter link description here ->
I removed the latest nodejs version with this
This error happens when your npm version is not what you think it is...
For instance, you download a nodejs pkg and install. Run node -v, npm -v... npm -v provides the error that brought you here.
This means your aren't using the version the nodejs pkg installed, but some remnant somewhere- from other install attempts.
In my case, I had a Homebrew installed version of npm that I didn't realize existed.
You can find the locations, at least on mac, using the 'where' command.
where npm
Which will return path(s) of your npm locations. Find the one that doesn't belong and give it the boot.
Then your npm -v will return the expected version number output.
Now you can execute npm commands.
I had the same problem.
I was using node 12 with nvm
Then, I switched to node 16, uninstalled the version 12 with nvm uninstall 12 and then I installed it again with nvm install 12 and it is working fine
For nvm used under macOS, I solve this issue in this way
First, run nvm ls-remote to get the latest version of v10
-> v10.24.1 (Latest LTS: Dubnium)
Then install the latest version of v10 through
nvm install 10.24.1 --latest-npm
In case anyone here needs to install an npm version (7.24.2) that does support node 10, rather than upgrade node.
Here is what I did:
url=`(curl -qSsL https://registry.npmjs.org/npm/7.24.2; echo "") | sed -e 's/^.*tarball":"//' | sed -e 's/".*$//'`
curl -qSsL -o npm.tgz "$url"
bin/npm-cli.js install -gf ../npm.tgz # in case npm is not installed where "which npm" points to, you might need to add --prefix=$(which npm | sed 's/\/bin\/npm//')
The reference is the installation script of 7.24.2 https://github.com/npm/cli/blob/v7.24.2/scripts/install.sh
In my case I had put ^ in one of the package version in my package.json. Which takes latest version of that library and it was not compatible to older npm version which caused me this error.
Remove all ^ from package versions and try again.
your nodejs version should come with its own npm that it supports.so if your machine has issues finding the npm version go to cdrive C:\Users\Machine name\AppData\Roaming
delete npm and npm cache folders.
Try below command
brew install node
then
npm install
None of the tips I found here helped.
I had to reinstall nvm.

Installed ES Lint globally but getting error -bash: eslint: command not found

I am on a mac using Catalina.
I installed ES Lint globally using
npm install -g eslint
the output says
/usr/local/opt/nvm/versions/node/v10.13.0/bin/eslint -> /usr/local/opt/nvm/versions/node/v10.13.0/lib/node_modules/eslint/bin/eslint.js
+ eslint#7.10.0
However I am confused because I made sure to use nvm uninstall node v10.13.0. Then I downloaded the latest install from the node website and installed it.
when I do node -v I get
v12.18.4
Why is it still installing ESlint it to the old 10.13.0 directory?

Upgraded node and npm via nvm, but old node is still used for global packages

I've been using node 9.3.0 for a long time, but I recently migrated to 10.12.0. Everything went fine, when I do node -v and npm -v I get the correct versions:
Paul-Bergs-Macbook:node paulrberg$ node -v
v10.12.0
Paul-Bergs-Macbook:node paulrberg$ which node
/Users/paulrberg/.nvm/versions/node/v10.12.0/bin/node
Paul-Bergs-Macbook:node paulrberg$ npm -v
6.4.1
Paul-Bergs-Macbook:node paulrberg$ which npm
/Users/paulrberg/.nvm/versions/node/v10.12.0/bin/npm
Howeven, when I'm trying to run any npm command, the old version is used. That is:
Paul-Bergs-Macbook:node paulrberg$ npm i truffle -g
/Users/paulrberg/.nvm/versions/node/v9.3.0/bin/truffle -> /Users/paulrberg/.nvm/versions/node/v9.3.0/lib/node_modules/truffle/build/cli.bundled.js
+ truffle#4.1.14
added 81 packages from 311 contributors in 1.715s
And:
npm list -g --depth=0
/Users/paulrberg/.nvm/versions/node/v9.3.0/lib
└── truffle#4.1.14
Not sure if this is some bash code still pointing to the last version, but I can't seem to find any proof for that. Running env and checking for 9.3.0 environment variables yields no result.
What I did so far:
Delete node 9.3.0 with nvm uninstall 9.3.0
Do a fresh install of nvm after deleting it and rebooting the computer
nvm reinstall-with-packages
Deleted ~/.nvmrc and set 10.12.0 in there afterwards
Check if I have an overlapping node from homebrew and I don't
What could the problem be?
After a few hours of painful Unix debugging, I realised the problem was that I set a prefix in npm config:
prefix = "/Users/paulrberg/.nvm/versions/node/v9.3.0"
To fix this, make sure to unset the prefix by doing:
npm config rm prefix
This is mentioned, albeit not necessarily shining in the nvm doc
If you have an ~/.npmrc file, make sure it does not contain any prefix
settings (which is not compatible with nvm)
It looks like you might need to run nvm reinstall-packages
https://github.com/creationix/nvm#migrating-global-packages-while-installing
which says
Migrating global packages while installing
If you want to install a new version of Node.js and migrate npm packages from a previous version:
nvm install node --reinstall-packages-from=node
This will first use "nvm version node" to identify the current version you're migrating packages from. Then it resolves the new version to install from the remote server and installs it. Lastly, it runs "nvm reinstall-packages" to reinstall the npm packages from your prior version of Node to the new one.
You can also install and migrate npm packages from specific versions of Node like this:
nvm install 6 --reinstall-packages-from=5
nvm install v4.2 --reinstall-packages-from=iojs
The other "solution" is not to use global packages. Particularly when using nvm and not being able to be sure that the global package is for the "current" version it can be better to install locally and use npx to run the local command
truffle installs a truffle command to ./node_modules/.bin when you npm install it so you can npx truffle to run the local one instead of truffle to run the global one
edit:
another thing to check is that node -v and nvm current don't necessarily report the same version.
I wonder if nvm current would report v9.3 for you?
ah, yep, on my machine I can install truffle globally in a different location than node -v reports
> node -v
v9.5.0
> nvm current
system
> nvm use v8
Now using node v8.4.0 (npm v5.3.0)
> node -v
v8.4.0
> nvm current
v8.4.0
> npm install -g truffle
/Users/pauldambra/.nvm/versions/node/v8.4.0/bin/truffle -> /Users/pauldambra/.nvm/versions/node/v8.4.0/lib/node_modules/truffle/build/cli.bundled.js
+ truffle#4.1.14
added 81 packages in 4.364s
So you might be missing an nvm use v10 command
I think that a more permanent solution is this section from the support docs.
Default global packages from file while installing
If you have a list of default packages you want installed every time you install a new version, we support that too -- just add the package names, one per line, to the file $NVM_DIR/default-packages. You can add anything npm would accept as a package argument on the command line.

Upgrade the version of nodejs to 5.12.0

I tried to install node.js by NVM in Ubuntu 16.04 server by following this link. And I got:
root#instance-15s8fbzx:/opt# nodejs --version
v4.2.6
root#instance-15s8fbzx:/opt# npm --version
5.3.0
root#instance-15s8fbzx:/opt# node --version
v8.4.0
Then, we I run a mean-stack project by sudo npm start, I got
class User {
^^^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
Then, I saw this link, I think maybe because the nodejs version is not correct. I have another server with v5.12.0 as the version of nodejs, and the project worked well there.
Then, I tried to do
sudo npm install -g npm
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/8.4.0/bin/node /usr/bin/node
But the version of the nodejs is still 4.2.6. Does anyone know how to upgrade its version to 5.12.0?
After you have installed NVM and you have installed the necessary version of node, you select the node version as follows:
> nvm use v5.12.0
After upgrading to the Nodejs version, the following error occurred for the Laravel and VUE js packages I already had:
PHP Fatal error: During inheritance of IteratorAggregate: Uncaught
ErrorException: Return type of
Symfony\Component\HttpFoundation\ParameterBag::getIterator() should
either be compatible with IteratorAggregate::getIterator():
Traversable, or the #[\ReturnTypeWillChange] attribute should be used
to temporarily suppress the notice in
C:\xampp\htdocs\clerk\vendor\symfony\http-foundation\ParameterBag.php:210
To solve the issue, I did the following:
composer update
npm update
npm run dev
php artisan serve

npm thinks node is out of date, but it isn't

I'm trying to install node-gyp. I run
sudo npm install -g node gyp
I get an error that says it requires node 0.8.0 and says that I'm running 0.6.12. The thing is, I'm not. I'm using NVM and I'm currently runnign 0.11.something. When I run node -v I get
v0.11.1
Why does NPM think I'm running node 0.6? I've set the default NVM to the latest.
The exact error is:
Unsupported
Not compatible with your version of node/npm: request#2.21.0
Required ["node >= 0.8.0"]
Actual {"npm":"1.1.4","node":"0.6.12"}
I'm running ubuntu.
It turns out that I had used
apt-get install nodejs
when I configured my system. That install had issues, and I ultimately used NVM. Even though node -v returned the correct version, I had to use apt-get to uninstall "node" (which left NVM's version just fine). Now I have new problems, but they are unrelated.

Resources