help icon indicating copy to clipboard operation
help copied to clipboard

npm does not support Node.js v10.19.0

Open barjenbruchlaw opened this issue 2 years ago • 38 comments

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. (/usr/local/lib/node_modules/npm/bin/npm-cli.js:2:25) at Module._compile (internal/modules/cjs/loader.js:778:30)

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.

barjenbruchlaw avatar Dec 08 '21 01:12 barjenbruchlaw

same to me on linux mint xfce

rbjnazz avatar Dec 09 '21 20:12 rbjnazz

same on Rasbian

ghost avatar Dec 11 '21 23:12 ghost

Same on Ubuntu 20

EladAvni avatar Dec 12 '21 15:12 EladAvni

anyone has fixed this?

theguitarvity avatar Dec 12 '21 17:12 theguitarvity

Update node to current version

harikishantk avatar Dec 12 '21 17:12 harikishantk

Update node to current version

How? (PS I'm using Ubuntu 20.04 on WSL on Windows 11-21H2)

JoKalliauer avatar Dec 12 '21 21:12 JoKalliauer

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

JoKalliauer avatar Dec 12 '21 21:12 JoKalliauer

Thank you JoKalliauer

hassonor avatar Dec 14 '21 21:12 hassonor

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 avatar Dec 16 '21 17:12 calisven

@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 avatar Dec 17 '21 20:12 JoKalliauer

@JoKalliauer Thanks bro !

BlockchainSpot avatar Dec 21 '21 10:12 BlockchainSpot

@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...

ToucanBran avatar Dec 21 '21 19:12 ToucanBran

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

maxbettercloud avatar Dec 21 '21 23:12 maxbettercloud

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]

awaism551 avatar Dec 31 '21 11:12 awaism551

Be sure to restart your shell after upgrading node if node -v is still returning the old version.

cale-mcnulty avatar Jan 06 '22 01:01 cale-mcnulty

Thank you JoKalliauer

NanoApes avatar Jan 07 '22 11:01 NanoApes

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

ek08 avatar Jan 13 '22 06:01 ek08

I had to delete the node_modules dir and follow the instructions from @JoKalliauer here. Finally a functional electron installation!

adithyakirank avatar Jan 13 '22 08:01 adithyakirank

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!

brko8088 avatar Jan 19 '22 15:01 brko8088

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 :(

IgnatBeresnev avatar Jan 19 '22 19:01 IgnatBeresnev

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

ramezwy5 avatar Jan 19 '22 20:01 ramezwy5

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 avatar Feb 02 '22 03:02 wetbadger

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

JoKalliauer avatar Feb 02 '22 10:02 JoKalliauer

i have just tried uninstalling and installing again and it worked for me

nvm uninstall 10 nvm install 10

rajeshbolisetty avatar Feb 02 '22 21:02 rajeshbolisetty

@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?

wetbadger avatar Feb 03 '22 01:02 wetbadger

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!

Davidfree2 avatar Feb 06 '22 08:02 Davidfree2

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

juaurqui avatar Feb 16 '22 21:02 juaurqui

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)

RonyMacfly avatar Feb 28 '22 17:02 RonyMacfly

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 avatar Mar 06 '22 21:03 sys128

@sys128 Please stay focused, declare the error you are getting and answer the questions in https://github.com/nodejs/help/issues/3644#issuecomment-1027773016 .

JoKalliauer avatar Mar 07 '22 17:03 JoKalliauer