help
help copied to clipboard
npm does not support Node.js v10.19.0
Details
I cannot access npm right now. My node version is 10.19.0, and my npm version is 6.14. Here is the error message I am getting:
npm does not support Node.js v10.19.0 You should probably upgrade to a newer version of node as we can't make any promises that npm will work with this version. You can find the latest version at https://nodejs.org/ /usr/local/lib/node_modules/npm/lib/npm.js:32 #unloaded = false ^
SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at module.exports (/usr/local/lib/node_modules/npm/lib/cli.js:22:15)
at Object.
I have installed nodejs and npm from the command line.
Node.js version
10.19.0
Example code
No response
Operating system
Kubuntu 20.04
Scope
Global
Module and version
Not applicable.
same to me on linux mint xfce
same on Rasbian
Same on Ubuntu 20
anyone has fixed this?
Update node to current version
Update node to current version
How? (PS I'm using Ubuntu 20.04 on WSL on Windows 11-21H2)
I improved the post because of a later post by @calisven
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
according to https://askubuntu.com/a/1382566/676490 And it worked, whithout any problems. :-D
Thank you JoKalliauer
I used
# Using Ubuntu curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - sudo apt-get install -y nodejs
according to https://askubuntu.com/a/548776/676490. And it worked. :-D
JoKalliauer I don't think this is a valid solution. Doing so would very likely cause breaking changes in the application as this would install the latest version of Node (currently 16.x) which is a big jump from 10.x. If you have a reasonably large Node app this would likely be a very bad idea unless you are willing to also fix any breaking changes that occur during the upgrade. Update: It actually installs Node 17.x, which is even worse as it's not even LTS
@calisven Thanks for your input. I don't have knowledge about node/npm. For me everything works with nodejs17.2, so I don't know what should be broken. Since the update it is less brocken than before.
Do you think updating to Node.js12 might be the best workaround?
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
Or should we downgrade npm to 6.14.12? (How?)
@JoKalliauer Thanks bro !
@calisven Thanks for your input. I don't have knowledge about node/npm. For me everything works with nodejs17.2, so I don't know what should be broken. Since the update it is less brocken than before.
Do you think updating to Node.js12 might be the best workaround?
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs
Or should we downgrade npm to 6.14.12? (How?)
I think we really need the node devs to weigh in on this at this point. This is pretty unacceptable since many applications run on lower versions were working and now are suddenly not...
If you have nvm
you can try re-installing node versions. Make sure you switch to the version of node for which your npm works first. For example switch to node 8 and then re-install other versions.
nvm use 8
nvm uninstall 10
nvm uninstall 12
nvm install 10
nvm install 12
nvm use 10
nvm alias default 10
nvm uninstall 8
I was facing this issue on my centos7 when my node version was 11.5.0
and npm version was 8
, I was able to run any command via npm and this error kept on coming, with yum installed nodejs and npm again with this command sudo yum install -y nodejs
, it installed [email protected] and [email protected]
Be sure to restart your shell after upgrading node if node -v
is still returning the old version.
Thank you JoKalliauer
I improved the post because of a later post by @calisven
curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs
according to https://askubuntu.com/a/1382566/676490 And it worked, whithout any problems. :-D
This is not working for me :-( . The error that I am getting is
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Error executing command, exiting
I had to delete the node_modules dir and follow the instructions from @JoKalliauer here. Finally a functional electron installation!
I had this issue recently, with the same output as above, for me @maxbettercloud solution solved the issue.
Just uninstall all npm versions and reinstall them over.
Hope this helps someone!
I made the mistake of updating npm before updating node, and had an error that Node 10.x is not supported.
I then wanted to update node using npm and got this error :(
I improved the post because of a later post by @calisven
curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs
according to https://askubuntu.com/a/1382566/676490 And it worked, whithout any problems. :-D
thank you for sharing this solution thumps up
I tried reinstalling, and JoKalliauer's suggestion, but this problem persists. I'd like to know what is causing it. It appeared in the middle of development after creating a sqlite database.
I tried reinstalling, and JoKalliauer's suggestion, but this problem persists. I'd like to know what is causing it. It appeared in the middle of development after creating a sqlite database.
@wetbadger Which nodejs-version do you have installed? (apt list nodejs -a
,node -v
, npm version
)
The output of all three commands should be at least 12.22.8
i have just tried uninstalling and installing again and it worked for me
nvm uninstall 10 nvm install 10
@wetbadger Which nodejs-version do you have installed? (
apt list nodejs -a
,node -v
,npm version
) The output of all three commands should be at least 12.22.8
@JoKalliauer I had version 10.19.0 which was installed from apt. I went to the node website and downloaded v16.13.2 and I no longer have this problem.
Since problem is solved you don't need to see the outputs, but here they are:
$ apt list nodejs -a
Listing... Done
nodejs/focal 10.19.0~dfsg-3ubuntu1 amd64
$ node -v
v16.13.2
$ npm version
{
npm: '8.1.2',
node: '16.13.2',
...
}
Why is apt so far behind even after update?
I improved the post because of a later post by @calisven
curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs
according to https://askubuntu.com/a/1382566/676490 And it worked, whithout any problems. :-D
Thank you so much. This worked great!
If you have
nvm
you can try re-installing node versions. Make sure you switch to the version of node for which your npm works first. For example switch to node 8 and then re-install other versions.nvm use 8 nvm uninstall 10 nvm uninstall 12 nvm install 10 nvm install 12 nvm use 10 nvm alias default 10 nvm uninstall 8
Thanks this is the perfect solution for me
I deleted the folder. The old version, installed through the file manager, now works.
sudo rm -r /usr/local/lib/node_modules/
I interrupted the execution of the commands.
sudo npm install npm@latest -g
curl https://www.npmjs.com/install.sh | sudo sh
npm -v
npm does not support Node.js v10.24.0
You should probably upgrade to a newer version of node as we
can't make any promises that npm will work with this version.
You can find the latest version at https://nodejs.org/
/usr/local/lib/node_modules/npm/lib/npm.js:32
#unloaded = false
^
SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
I improved the post because of a later post by @calisven
curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs
according to https://askubuntu.com/a/1382566/676490 And it worked, whithout any problems. :-D
Was unsuccessful. Just reported an error, exiting. Nothing else specified. NodeJS also reports that it is on the latest version when I'm pretty sure it isn't. NodeJS version is 10.19.0 like everyone else here.
@sys128 Please stay focused, declare the error you are getting and answer the questions in https://github.com/nodejs/help/issues/3644#issuecomment-1027773016 .