Ubuntu error cannot find module semver

I can't use npm install using the command prompt in NodeJS. I'm getting these errors when running npm install: module.js:339 throw err; ^ Error: Cannot find module 'semver' at Function.

I can’t use npm install using the command prompt in NodeJS. I’m getting these errors when running npm install:

module.js:339
    throw err;
    ^
Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (C:UsersadminAppDataRoamingnpmnode_modulesnpml
ibconfigdefaults.js:6:14)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)

Kalle Richter's user avatar

Kalle Richter

7,72425 gold badges70 silver badges167 bronze badges

asked Nov 23, 2015 at 11:55

user2447562's user avatar

6

I had the same error. npm uninstall npm -g, rm -rf node_modules didn’t help me, because when I tried I was getting Error: Cannot find module 'semver'. But I solve my problem with these steps (this will delete other global modules you may be using):

  • sudo rm -rf /usr/local/lib/node_modules
  • sudo rm -rf ~/.npm
  • brew uninstall --force node
  • brew install node

Hope this will help those who are getting a similar problem.

WoodenKitty's user avatar

WoodenKitty

6,4418 gold badges51 silver badges72 bronze badges

answered Feb 24, 2016 at 8:35

artiebits's user avatar

artiebitsartiebits

5,1051 gold badge13 silver badges15 bronze badges

21

if you are in Linux server exit from the server and re ssh

answered Aug 7, 2020 at 17:51

Supun Madushanka's user avatar

Supun MadushankaSupun Madushanka

2,1801 gold badge10 silver badges11 bronze badges

12

I’m facing the same issue here.

If this occurs right after you run brew install yarn try running yarn global add npm and voilà — fixed!

Matthias Braun's user avatar

answered Mar 22, 2018 at 6:42

Ashoor's user avatar

AshoorAshoor

1,3481 gold badge9 silver badges11 bronze badges

1

On MS Windows, the solution is to remove %APPDATA%npm and reinstall node

WoJ's user avatar

WoJ

25.5k46 gold badges161 silver badges317 bronze badges

answered Dec 6, 2016 at 17:02

Gangadhar's user avatar

GangadharGangadhar

6215 silver badges2 bronze badges

6

On Ubuntu, if you would rather manage Node through the default repositories using apt, it’s best to install both nodejs and npm this way.

It’s very likely that the version of npm you are using is expecting semver in a specific place that is not aligned with the version of Node JS you have installed. If there is only one version of nodejs and only one version of npm, and they are both installed using the default repositories, this should work perfectly.

Here is my best guidance for getting Node and npm working using the main Ubuntu repositories:

  1. sudo apt-get purge nodejs --auto-remove and sudo apt-get purge npm --auto-remove
  2. whereis node: remove all the versions of node, one at a time. Repeat until this command returns a blank after node:.
  3. sudo apt-get install nodejs
  4. node --version: should return ... no such file or directory
  5. nodejs --version: should return v1x.x.x. This is the version installed by apt. It will probably be less recent that the latest version available on the Node JS website.
  6. sudo apt-get install npm
  7. npm --version: it will use the nodejs installed by apt and work correctly.

answered Aug 28, 2020 at 14:29

Schmudde's user avatar

SchmuddeSchmudde

1,0181 gold badge11 silver badges19 bronze badges

10

I had this too, after running brew install yarn yesterday. At least, everything was fine up until then.

I ran rm -rf node_modules and tried to reinstall, but no npm command was working.

In the end I took the rather simple step of reinstalling Node via the official Node installer for Mac OS X.

https://nodejs.org/en/download/

Everything is fine now. Just went back to the directory, ran npm install and it’s done the trick.

answered Mar 20, 2017 at 10:43

codewithfeeling's user avatar

codewithfeelingcodewithfeeling

5,9986 gold badges38 silver badges51 bronze badges

4

On Arch Linux what did the trick for me was:

sudo pacman -Rs npm
sudo pacman -S npm

answered Sep 30, 2017 at 3:27

Telmo Trooper's user avatar

Telmo TrooperTelmo Trooper

4,6131 gold badge28 silver badges34 bronze badges

1

I had the same problem, the way i solved it was by executing

PATH="$PATH"

in terminal, problem was the terminal kept the old path of nodejs instead of using the new one.

answered Nov 14, 2021 at 11:59

darylvickerman's user avatar

0

Having just encountered this on Arch Linux 4.13.3, I solved the issue by simply reinstalling semver:

pacman -S semver

answered Sep 29, 2017 at 15:41

Matthias Braun's user avatar

Matthias BraunMatthias Braun

30.6k21 gold badges141 silver badges165 bronze badges

Actually, it is taking the reference of previously stored modules.

Solution:Delete the npm-cache/npm folder in the installation directory of nodejs.
In windows, it is in C:/User/Username/Appdata/Roaming/npm(or npm_cache).
and try to install again.

Same thing to do in any OS.

Vince Bowdren's user avatar

answered Oct 1, 2017 at 16:20

Shubham Jaiswal's user avatar

1

In my case on macOS(10.13.6), when I executed the following command

npm install -g react-native-cli

I got this error

Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787: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)

The error got resolved after executing the command

yarn global add npm

proposed by @Ashoor

answered Aug 19, 2019 at 17:45

zeeawan's user avatar

zeeawanzeeawan

6,5672 gold badges50 silver badges54 bronze badges

1

sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* ~/.npm
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/bin/node*
sudo rm -rf /usr/local/include/node*

sudo apt-get purge nodejs npm
sudo apt autoremove

Then install node and npm

answered Dec 3, 2020 at 21:55

Mohamed Farouk's user avatar

Mohamed FaroukMohamed Farouk

8171 gold badge13 silver badges28 bronze badges

Just uninstall node js then reinstall it using nvm. Your problem will be solved. I am a debian 10 user.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

after executing the command. close your terminal and reopen then run this command to install node js latest version.

nvm install v14.15.5

now check by typing node -v

answered Mar 11, 2021 at 8:59

Mahedi Hasan Durjoy's user avatar

1

Just make sure semver is installed: npm install -g semver

answered Apr 10, 2019 at 13:40

Jérôme Beau's user avatar

Jérôme BeauJérôme Beau

10.3k5 gold badges48 silver badges50 bronze badges

2

For me, this happened after I installed yarn globally.
To resolve this issue, install npm using yarn and done.

yarn global add npm

answered Feb 9, 2020 at 7:15

the_haystacker's user avatar

On Windows, downloading Node’s MSI again and doing a ‘Repair’ worked for me.

answered Jun 14, 2017 at 20:59

Sornakumar's user avatar

SornakumarSornakumar

4325 silver badges20 bronze badges

I had the same issue but it was caused by a broken package-lock.json file.

Deleting package-lock.json and running npm install again fixed it for me.

answered Jul 14, 2017 at 4:37

Wireblue's user avatar

WireblueWireblue

1,3091 gold badge13 silver badges24 bronze badges

0

This worked for me on Ubuntu (latest version dated Oct/2020)

I had to first get code from the bash source:

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

This got the latest version of node which updated my libraries and got rid of the ‘semver’ error.

answered Oct 2, 2020 at 23:51

Snowcat's user avatar

SnowcatSnowcat

4217 silver badges15 bronze badges

I got same error and I solved it.

delete package-lock.json file and node_modules folder then npm install

answered Feb 4, 2021 at 5:31

Justin Joseph's user avatar

Justin JosephJustin Joseph

2,4731 gold badge11 silver badges16 bronze badges

just remove your node_modules

rm -rf node_modules

than

yarn

or

npm install

answered Feb 16, 2021 at 22:00

Rashid Iqbal's user avatar

Rashid IqbalRashid Iqbal

1,02912 silver badges12 bronze badges

0

Just a reminder of executable npm execute via node env:

xb@dnxb:/tmp$ type -a npm
npm is /usr/bin/npm
npm is /bin/npm
xb@dnxb:/tmp$ realpath /usr/bin/npm /bin/npm
/usr/share/npm/bin/npm-cli.js
/usr/share/npm/bin/npm-cli.js
xb@dnxb:/tmp$ 
xb@dnxb:/tmp$ head -1 /usr/share/npm/bin/npm-cli.js
#!/usr/bin/env node

I can check which node is chosen by type -a, the first line has the most priority, i.e. I can get same error if I run /usr/local/bin/node /usr/share/npm/bin/npm-cli.js, but no error if I run /usr/bin/node /usr/share/npm/bin/npm-cli.js:

xb@dnxb:/tmp$ type -a node
node is /usr/local/bin/node
node is /usr/bin/node
node is /bin/node
xb@dnxb:/tmp$ realpath /usr/local/bin/node
/usr/local/bin/node
xb@dnxb:/tmp$ realpath /usr/bin/node
/usr/bin/node
xb@dnxb:/tmp$ realpath /bin/node
/usr/bin/node
xb@dnxb:/tmp$ 

There are 2 unique node exe based on realpath. If you have the similar case, then you need to find out how to remove the undesired/broken node exe, e.g. sudo rm /usr/local/bin/node or manipulate env $PATH.

answered Jan 13, 2022 at 19:55

林果皞's user avatar

林果皞林果皞

7,3813 gold badges52 silver badges69 bronze badges

First you can try close current terminal tab and open new its work fine

answered Oct 22, 2022 at 12:51

roni naruka's user avatar

2

Faced this issue when I ran npm install using a lower version of node. Then later when I upgraded to latest version of node and ran gulp, it has shown this error.

To resolve, deleted node_modules and re-ran npm install. Then gulp ran fine.

Jörn Hees's user avatar

Jörn Hees

3,29820 silver badges42 bronze badges

answered Feb 26, 2018 at 12:04

cedric's user avatar

i was getting an error saying Permission Denied after running any ‘ng’ command (ng —version). I googled for a while and tried clearing npm cache npm cache verify, uninstalling my global angular cli (npm uninstall -g @angular/cli) and reinstalling Angular/cli (npm install -g @angular/cli) etc.. but it would give an error say its already installed. but the node_modules folder here wouldn’t have any angular folder.. reinstalled node even then restarted my computer.

ANSWER: Finally I found that the ng.cmd and ng.ps1 files in C:UsersJaGoodwinAppDataRoamingnpm here were still there (in npm folder).. even though I did npm uninstall -g @angular/cli. those files were causing ng (angular/cli) to think it was still installed. i deleted those files then npm install -g @angular/cli@8.3.29 (version i need) I then removed my projects node_modules and then ran npm install and now can run my angular project using ng serve.

enter image description here

C:UsersJaGoodwinAppDataRoamingnpm

Find this by folder searching %APPDATA% in your windows search bar.

answered Oct 29, 2020 at 21:09

Jaden Goodwin's user avatar

Start fresh.

brew uninstall --force node
brew install node

answered Jan 12, 2021 at 12:07

Grant's user avatar

GrantGrant

5,3202 gold badges37 silver badges46 bronze badges

Just delete (or rename) the cloned repository’s version of semver folder:
"gitClonedRepository/App/node_modules/semver"

and copy the «semver» folder from
"C:Program Filesnodejsnode_modulesnpmnode_modulessemver"

into the application’s node_modules folder.

(if you’re on Windows, othervise it must be located somewhere in /usr/local/lib/node_modules).

answered Nov 25, 2021 at 1:38

Ivan  Silkin's user avatar

Ivan SilkinIvan Silkin

3357 silver badges15 bronze badges

All I needed was sudo rm -rf node_modules/ in the directory I was working in. This happened after I updated my node version with n lts

answered Jun 2, 2022 at 2:25

Jacob Solawetz's user avatar

I finally figured this out! Yes, you have to uninstall/delete all files and reinstall. BUT SOME OF THE FILE PATHS ARE TOO LONG TO DELETE DURING THE UNINSTALL PROCESS. The file paths are so long in Node that they may not be able to be deleted. You have to rename the file paths.

After uninstalling Node, use Command Prompt, navigate to …Appdataroaming (use the path from the error message). Try to delete the folder with del npm. Then, if it doesn’t allow you to delete a folder, start renaming the folders in the file path in the next error message to «a» or something short. You may have to do this for multiple folders along the path. Then you should be able to delete! Then reinstall node and it should work.

answered Nov 9, 2017 at 15:12

The Windhover's user avatar

0

For me, it happened while upgrading to gulp 4 from gulp 3 in my project.
So, when I run «gulp watch» command, it was throwing me same error.

It’s probably due to version mismatch as compared to my globally installed gulp.

So, either upgrading gulp with «-g» global flag would help, or else I followed this below

However, I used «./node_modules/.bin/gulp watch» in my project. This ensures that all the dependencies that gulp needs are taken from node_modules only.

answered Apr 7, 2020 at 13:11

master_dodo's user avatar

master_dodomaster_dodo

1,1463 gold badges19 silver badges30 bronze badges

I am getting the following error whenever I try to run npm command.

internal/modules/cjs/loader.js:626
throw err;
^

Error: Cannot find module 'semver'
Require stack:
- /usr/share/npm/lib/utils/unsupported.js
- /usr/share/npm/bin/npm-cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15)
    at Function.Module._load (internal/modules/cjs/loader.js:527:27)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/usr/share/npm/lib/utils/unsupported.js:2:14)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/share/npm/lib/utils/unsupported.js',
    '/usr/share/npm/bin/npm-cli.js'
  ]
}

I was basically trying to make offline use of FreeCodeCamp. It asked me to run command ‘npm ci’ from which I started getting this error.

I tried reinstalling npm but it won’t work. I also tried installing the semver module which also didn’t help.

What might have gone wrong and how can I fix this?

asked Jun 20, 2019 at 11:19

Shirish Pokhrel's user avatar

Shirish PokhrelShirish Pokhrel

3711 gold badge3 silver badges5 bronze badges

Found a similar question here and the answer worked.

sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* ~/.npm
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/bin/node*
sudo rm -rf /usr/local/include/node*

sudo apt-get purge nodejs npm
sudo apt autoremove

Download the latest tar.xz NodeJS file from https://nodejs.org/en/download/

tar -xf node-v#.#.#-linux-x64.tar.xz
sudo mv node-v#.#.#-linux-x64/bin/* /usr/local/bin/
sudo mv node-v#.#.#-linux-x64/lib/node_modules/ /usr/local/lib/

Where #.#.# is the version you downloaded.

Verify installation using

node -v
npm -v

answered Sep 3, 2019 at 0:01

Bilbo Baggins's user avatar

3

It depends on how you want to manage Node JS/npm.

As Bilbo Baggins suggested, you can install the latest LTS version of Node JS from the official website: https://nodejs.org/en/download/.

On Ubuntu, if you would rather manage Node through the default repositories using apt, it’s best to install both nodejs and npm this way.

It’s very likely that the version of npm you are using is expecting semver in a specific place that is not aligned with the version of Node JS you have installed. If there is only one version of nodejs and only one version of npm, and they are both installed using the default repositories, this should work perfectly.

Here is my best guidance for getting Node and npm working using the main Ubuntu repositories:

  1. sudo apt-get purge nodejs --auto-remove and sudo apt-get purge npm --auto-remove
  2. whereis node: remove all the versions of node, one at a time. Repeat until this command returns a blank after node:.
  3. sudo apt-get install nodejs
  4. node --version: should return ... no such file or directory
  5. nodejs --version: should return v1x.x.x. This is the version installed by apt. It will probably be less recent that the latest version available on the Node JS website.
  6. sudo apt-get install npm
  7. npm --version: it will use the nodejs installed by apt and work correctly.

answered Aug 28, 2020 at 14:23

Schmudde's user avatar

SchmuddeSchmudde

1711 silver badge4 bronze badges

I was using nvm to manage node versions, In my case npm syslink was broken i solved it by uninstalling and then reinstalling node again

check your node version using node --version

then run nvm uninstall <your version>

then reinstall using nvm install <your version

answered Aug 31, 2021 at 5:33

mumboFromAvnotaklu's user avatar

Run this command it will automatically remove previous version of npm and install new version of npm, worked for me, you can check here for details https://github.com/npm/cli

 curl -qL https://www.npmjs.com/install.sh | sh

answered May 20, 2021 at 8:55

Ujjawal Mandhani's user avatar

2

I was facing an Angular project. Somehow, Angular-CLI (ng) was removed.
So I just verified that node and npm are installed and did the following which fixed it:

sudo npm install -g @angular/cli 

ThunderBird's user avatar

ThunderBird

1,90513 gold badges19 silver badges31 bronze badges

answered May 5, 2021 at 5:37

Vikram Ray's user avatar

In my case I was using nvm so I had to remove all node versions (rm -rf ~/.nvm/versions/node/*)
then install both nodejs and npm :

sudo apt install nodejs
sudo apt install npm

answered Mar 20, 2022 at 11:19

Badr Bellaj's user avatar

I had the same issue but on 22.04. None of the above worked for me, but I found this process that did. https://codemarvels.com/2021/03/20/npm-install-gives-error-cannot-find-module-semver/
Essentially:

sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* ~/.npm
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/bin/node*
sudo rm -rf /usr/local/include/node*
sudo apt-get purge nodejs npm
sudo apt autoremove
sudo apt-get install nodejs npm

answered Aug 25, 2022 at 16:44

Andy Carr's user avatar

I can’t use npm install using the command prompt in NodeJS. I’m getting these errors when running npm install:

module.js:339
    throw err;
    ^
Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (C:UsersadminAppDataRoamingnpmnode_modulesnpml
ibconfigdefaults.js:6:14)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)

Kalle Richter's user avatar

Kalle Richter

7,72425 gold badges70 silver badges167 bronze badges

asked Nov 23, 2015 at 11:55

user2447562's user avatar

6

I had the same error. npm uninstall npm -g, rm -rf node_modules didn’t help me, because when I tried I was getting Error: Cannot find module 'semver'. But I solve my problem with these steps (this will delete other global modules you may be using):

  • sudo rm -rf /usr/local/lib/node_modules
  • sudo rm -rf ~/.npm
  • brew uninstall --force node
  • brew install node

Hope this will help those who are getting a similar problem.

WoodenKitty's user avatar

WoodenKitty

6,4418 gold badges51 silver badges72 bronze badges

answered Feb 24, 2016 at 8:35

artiebits's user avatar

artiebitsartiebits

5,1051 gold badge13 silver badges15 bronze badges

21

if you are in Linux server exit from the server and re ssh

answered Aug 7, 2020 at 17:51

Supun Madushanka's user avatar

Supun MadushankaSupun Madushanka

2,1801 gold badge10 silver badges11 bronze badges

12

I’m facing the same issue here.

If this occurs right after you run brew install yarn try running yarn global add npm and voilà — fixed!

Matthias Braun's user avatar

answered Mar 22, 2018 at 6:42

Ashoor's user avatar

AshoorAshoor

1,3481 gold badge9 silver badges11 bronze badges

1

On MS Windows, the solution is to remove %APPDATA%npm and reinstall node

WoJ's user avatar

WoJ

25.5k46 gold badges161 silver badges317 bronze badges

answered Dec 6, 2016 at 17:02

Gangadhar's user avatar

GangadharGangadhar

6215 silver badges2 bronze badges

6

On Ubuntu, if you would rather manage Node through the default repositories using apt, it’s best to install both nodejs and npm this way.

It’s very likely that the version of npm you are using is expecting semver in a specific place that is not aligned with the version of Node JS you have installed. If there is only one version of nodejs and only one version of npm, and they are both installed using the default repositories, this should work perfectly.

Here is my best guidance for getting Node and npm working using the main Ubuntu repositories:

  1. sudo apt-get purge nodejs --auto-remove and sudo apt-get purge npm --auto-remove
  2. whereis node: remove all the versions of node, one at a time. Repeat until this command returns a blank after node:.
  3. sudo apt-get install nodejs
  4. node --version: should return ... no such file or directory
  5. nodejs --version: should return v1x.x.x. This is the version installed by apt. It will probably be less recent that the latest version available on the Node JS website.
  6. sudo apt-get install npm
  7. npm --version: it will use the nodejs installed by apt and work correctly.

answered Aug 28, 2020 at 14:29

Schmudde's user avatar

SchmuddeSchmudde

1,0181 gold badge11 silver badges19 bronze badges

10

I had this too, after running brew install yarn yesterday. At least, everything was fine up until then.

I ran rm -rf node_modules and tried to reinstall, but no npm command was working.

In the end I took the rather simple step of reinstalling Node via the official Node installer for Mac OS X.

https://nodejs.org/en/download/

Everything is fine now. Just went back to the directory, ran npm install and it’s done the trick.

answered Mar 20, 2017 at 10:43

codewithfeeling's user avatar

codewithfeelingcodewithfeeling

5,9986 gold badges38 silver badges51 bronze badges

4

On Arch Linux what did the trick for me was:

sudo pacman -Rs npm
sudo pacman -S npm

answered Sep 30, 2017 at 3:27

Telmo Trooper's user avatar

Telmo TrooperTelmo Trooper

4,6131 gold badge28 silver badges34 bronze badges

1

I had the same problem, the way i solved it was by executing

PATH="$PATH"

in terminal, problem was the terminal kept the old path of nodejs instead of using the new one.

answered Nov 14, 2021 at 11:59

darylvickerman's user avatar

0

Having just encountered this on Arch Linux 4.13.3, I solved the issue by simply reinstalling semver:

pacman -S semver

answered Sep 29, 2017 at 15:41

Matthias Braun's user avatar

Matthias BraunMatthias Braun

30.6k21 gold badges141 silver badges165 bronze badges

Actually, it is taking the reference of previously stored modules.

Solution:Delete the npm-cache/npm folder in the installation directory of nodejs.
In windows, it is in C:/User/Username/Appdata/Roaming/npm(or npm_cache).
and try to install again.

Same thing to do in any OS.

Vince Bowdren's user avatar

answered Oct 1, 2017 at 16:20

Shubham Jaiswal's user avatar

1

In my case on macOS(10.13.6), when I executed the following command

npm install -g react-native-cli

I got this error

Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787: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)

The error got resolved after executing the command

yarn global add npm

proposed by @Ashoor

answered Aug 19, 2019 at 17:45

zeeawan's user avatar

zeeawanzeeawan

6,5672 gold badges50 silver badges54 bronze badges

1

sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* ~/.npm
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/bin/node*
sudo rm -rf /usr/local/include/node*

sudo apt-get purge nodejs npm
sudo apt autoremove

Then install node and npm

answered Dec 3, 2020 at 21:55

Mohamed Farouk's user avatar

Mohamed FaroukMohamed Farouk

8171 gold badge13 silver badges28 bronze badges

Just uninstall node js then reinstall it using nvm. Your problem will be solved. I am a debian 10 user.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

after executing the command. close your terminal and reopen then run this command to install node js latest version.

nvm install v14.15.5

now check by typing node -v

answered Mar 11, 2021 at 8:59

Mahedi Hasan Durjoy's user avatar

1

Just make sure semver is installed: npm install -g semver

answered Apr 10, 2019 at 13:40

Jérôme Beau's user avatar

Jérôme BeauJérôme Beau

10.3k5 gold badges48 silver badges50 bronze badges

2

For me, this happened after I installed yarn globally.
To resolve this issue, install npm using yarn and done.

yarn global add npm

answered Feb 9, 2020 at 7:15

the_haystacker's user avatar

On Windows, downloading Node’s MSI again and doing a ‘Repair’ worked for me.

answered Jun 14, 2017 at 20:59

Sornakumar's user avatar

SornakumarSornakumar

4325 silver badges20 bronze badges

I had the same issue but it was caused by a broken package-lock.json file.

Deleting package-lock.json and running npm install again fixed it for me.

answered Jul 14, 2017 at 4:37

Wireblue's user avatar

WireblueWireblue

1,3091 gold badge13 silver badges24 bronze badges

0

This worked for me on Ubuntu (latest version dated Oct/2020)

I had to first get code from the bash source:

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

This got the latest version of node which updated my libraries and got rid of the ‘semver’ error.

answered Oct 2, 2020 at 23:51

Snowcat's user avatar

SnowcatSnowcat

4217 silver badges15 bronze badges

I got same error and I solved it.

delete package-lock.json file and node_modules folder then npm install

answered Feb 4, 2021 at 5:31

Justin Joseph's user avatar

Justin JosephJustin Joseph

2,4731 gold badge11 silver badges16 bronze badges

just remove your node_modules

rm -rf node_modules

than

yarn

or

npm install

answered Feb 16, 2021 at 22:00

Rashid Iqbal's user avatar

Rashid IqbalRashid Iqbal

1,02912 silver badges12 bronze badges

0

Just a reminder of executable npm execute via node env:

xb@dnxb:/tmp$ type -a npm
npm is /usr/bin/npm
npm is /bin/npm
xb@dnxb:/tmp$ realpath /usr/bin/npm /bin/npm
/usr/share/npm/bin/npm-cli.js
/usr/share/npm/bin/npm-cli.js
xb@dnxb:/tmp$ 
xb@dnxb:/tmp$ head -1 /usr/share/npm/bin/npm-cli.js
#!/usr/bin/env node

I can check which node is chosen by type -a, the first line has the most priority, i.e. I can get same error if I run /usr/local/bin/node /usr/share/npm/bin/npm-cli.js, but no error if I run /usr/bin/node /usr/share/npm/bin/npm-cli.js:

xb@dnxb:/tmp$ type -a node
node is /usr/local/bin/node
node is /usr/bin/node
node is /bin/node
xb@dnxb:/tmp$ realpath /usr/local/bin/node
/usr/local/bin/node
xb@dnxb:/tmp$ realpath /usr/bin/node
/usr/bin/node
xb@dnxb:/tmp$ realpath /bin/node
/usr/bin/node
xb@dnxb:/tmp$ 

There are 2 unique node exe based on realpath. If you have the similar case, then you need to find out how to remove the undesired/broken node exe, e.g. sudo rm /usr/local/bin/node or manipulate env $PATH.

answered Jan 13, 2022 at 19:55

林果皞's user avatar

林果皞林果皞

7,3813 gold badges52 silver badges69 bronze badges

First you can try close current terminal tab and open new its work fine

answered Oct 22, 2022 at 12:51

roni naruka's user avatar

2

Faced this issue when I ran npm install using a lower version of node. Then later when I upgraded to latest version of node and ran gulp, it has shown this error.

To resolve, deleted node_modules and re-ran npm install. Then gulp ran fine.

Jörn Hees's user avatar

Jörn Hees

3,29820 silver badges42 bronze badges

answered Feb 26, 2018 at 12:04

cedric's user avatar

i was getting an error saying Permission Denied after running any ‘ng’ command (ng —version). I googled for a while and tried clearing npm cache npm cache verify, uninstalling my global angular cli (npm uninstall -g @angular/cli) and reinstalling Angular/cli (npm install -g @angular/cli) etc.. but it would give an error say its already installed. but the node_modules folder here wouldn’t have any angular folder.. reinstalled node even then restarted my computer.

ANSWER: Finally I found that the ng.cmd and ng.ps1 files in C:UsersJaGoodwinAppDataRoamingnpm here were still there (in npm folder).. even though I did npm uninstall -g @angular/cli. those files were causing ng (angular/cli) to think it was still installed. i deleted those files then npm install -g @angular/cli@8.3.29 (version i need) I then removed my projects node_modules and then ran npm install and now can run my angular project using ng serve.

enter image description here

C:UsersJaGoodwinAppDataRoamingnpm

Find this by folder searching %APPDATA% in your windows search bar.

answered Oct 29, 2020 at 21:09

Jaden Goodwin's user avatar

Start fresh.

brew uninstall --force node
brew install node

answered Jan 12, 2021 at 12:07

Grant's user avatar

GrantGrant

5,3202 gold badges37 silver badges46 bronze badges

Just delete (or rename) the cloned repository’s version of semver folder:
"gitClonedRepository/App/node_modules/semver"

and copy the «semver» folder from
"C:Program Filesnodejsnode_modulesnpmnode_modulessemver"

into the application’s node_modules folder.

(if you’re on Windows, othervise it must be located somewhere in /usr/local/lib/node_modules).

answered Nov 25, 2021 at 1:38

Ivan  Silkin's user avatar

Ivan SilkinIvan Silkin

3357 silver badges15 bronze badges

All I needed was sudo rm -rf node_modules/ in the directory I was working in. This happened after I updated my node version with n lts

answered Jun 2, 2022 at 2:25

Jacob Solawetz's user avatar

I finally figured this out! Yes, you have to uninstall/delete all files and reinstall. BUT SOME OF THE FILE PATHS ARE TOO LONG TO DELETE DURING THE UNINSTALL PROCESS. The file paths are so long in Node that they may not be able to be deleted. You have to rename the file paths.

After uninstalling Node, use Command Prompt, navigate to …Appdataroaming (use the path from the error message). Try to delete the folder with del npm. Then, if it doesn’t allow you to delete a folder, start renaming the folders in the file path in the next error message to «a» or something short. You may have to do this for multiple folders along the path. Then you should be able to delete! Then reinstall node and it should work.

answered Nov 9, 2017 at 15:12

The Windhover's user avatar

0

For me, it happened while upgrading to gulp 4 from gulp 3 in my project.
So, when I run «gulp watch» command, it was throwing me same error.

It’s probably due to version mismatch as compared to my globally installed gulp.

So, either upgrading gulp with «-g» global flag would help, or else I followed this below

However, I used «./node_modules/.bin/gulp watch» in my project. This ensures that all the dependencies that gulp needs are taken from node_modules only.

answered Apr 7, 2020 at 13:11

master_dodo's user avatar

master_dodomaster_dodo

1,1463 gold badges19 silver badges30 bronze badges

Содержание

  1. Error: Cannot find module ‘semver’ #9445
  2. Comments
  3. Npm install cannot find module ‘semver’
  4. 39 Answers 39
  5. Npm install не может найти модуль ‘semver’
  6. npm: cannot find module semver error while using npm command in linux ubuntu [duplicate]
  7. 2 Answers 2
  8. Linked
  9. Related
  10. Hot Network Questions
  11. Установка Npm не может найти модуль ‘semver’

Error: Cannot find module ‘semver’ #9445

Today I encountered this and not able to install a single package .

The text was updated successfully, but these errors were encountered:

Hi, I’ve encountered almost the same issue. any solutions?

angular-seed@0.0.0 prestart c:Sitestemplatestore
npm install

module.js:338
throw err;
^

Error: Cannot find module ‘semver’
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (C:UserssteinAppDataRoamingnpmnode_modulesnpmlibconfigdefaults.js:7:14)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)

npm ERR! Windows_NT 10.0.10240
npm ERR! argv «c:Program Filesnodejsnode.exe» «c:Program Filesnodejsnode_modulesnpmbinnpm-cli.js» «start»
npm ERR! node v4.0.0
npm ERR! npm v2.14.2
npm ERR! code ELIFECYCLE
npm ERR! angular-seed@0.0.0 prestart: npm install
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-seed@0.0.0 prestart script ‘npm install’.
npm ERR! This is most likely a problem with the angular-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm install
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-seed
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! c:Sitestemplatestorenpm-debug.log

I just restarted my PC and the error vanished. However, the issue is why it occurs in the first place .

Gonna try right now, pc has restarted. Anything else you did when the error vanished? Remade the entire directory with npm install first?

I’m on Windows 10

Just reinstall npm , i think you should be good to go !

You mean ‘npm install’ again to the directory where I’ve cloned the app (angular seed) to? No luck 🙁 I’ll try again tomorrow morning

Enviado desde mi iPhone

Just reinstall npm , i think you should be good to go !


Reply to this email directly or view it on GitHub.

I’m running Linux Arch. Semver was a separate package that was not reinstalled when I tried reinstalling npm. When I realized this I just reinstalled semver and this issue was resolved in my case.

1 cd ghost
2 rm -rf node_modules
3 npm install —production
4 npm start

I am encountering this with windows10, and when I tried reinstalling node, doesn’t work.

——- what I get
module.js:471
throw err;
^

Error: Cannot find module ‘semver’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:UsersPzhAppDataRoamingnpmnode_modulesnpmlibutilsunsupported.js:2:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

@imPZH could you try installing the Semver package like techwooten did here: #9445 (comment) ?

npm install -g semver

@Charlotteis I tried. once I type ‘npm’,
such as
‘npm’
‘npm -v’
‘npm install -g semver ‘

I got the error.

I deleted ‘npm’ and ‘npm_cache’ folder in ‘ C:UsersPzhAppDataRoaming’, and changed environment variables ‘PATH’. The error disappears.

Any still having this issue after trying what @imPZH suggested?

Similar error happens on simple npm command call. Take a look at this Docker image log:
https://hub.docker.com/r/jazzypro/ubuntu-node-electron/builds/bky5uoiqd4wsfkqkwphvgov/

This error means the npm installation itself is hosed. Remove npm from your local machine and reinstall it. Assuming you don’t have any weird filesystem problems going on with files going suddenly missing.

@saru95 seems to have resolved their issue, so I’m going to close this one.

Источник

Npm install cannot find module ‘semver’

I can’t use npm install using the command prompt in NodeJS. I’m getting these errors when running npm install :

39 Answers 39

Nevermind install Yarn.Performs parallel installation resulting in better speed and performance from npm

Just remove the /node_modules folder and try again. 😉

You can use npm rm to remove it.

You can also check this issue on GitHub. To be more specific about unnistal, try to follow this:

So sad to see you go.

sudo npm uninstall npm -g Or, if that fails,

sudo make uninstall More Severe Uninstalling

Usually, the above instructions are sufficient. That will remove npm, but leave behind anything you’ve installed.

If you would like to remove all the packages that you have installed, then you can use the npm ls command to find them, and then npm rm to remove them.

To remove cruft left behind by npm 0.x, you can use the included clean-old.sh script file. You can run it conveniently like this:

npm explore npm -g — sh scripts/clean-old.sh npm uses two configuration files, one for per-user configs, and another for global (every-user) configs. You can view them by doing:

npm config get userconfig # defaults to

/.npmrc npm config get globalconfig # defaults to /usr/local/etc/npmrc Uninstalling npm does not remove configuration files by default. You must remove them yourself manually if you want them gone. Note that this means that future npm installs will not remember the settings that you have chosen.

Источник

Npm install не может найти модуль ‘semver’

Я не могу использовать npm install с помощью командной строки в NodeJS. Я получаю эти ошибки при запуске npm install :

пожалуйста, помогите мне

У меня была такая же ошибка. npm uninstall npm -g , rm -rf node_modules мне не помогли, потому что, когда я пытался, я получал сообщение об Error: Cannot find module ‘semver’ . Но я решаю свою проблему с помощью этих шагов (это удалит другие глобальные модули, которые вы можете использовать):

  • sudo rm -rf/usr/local/lib/node_modules
  • sudo rm -rf

/.npm

  • brew uninstall —force node
  • brew install node
  • Надеюсь, что это поможет тем, кто получает подобную проблему.

    Я сталкиваюсь с той же проблемой здесь.

    Если это происходит сразу после запуска brew install yarn попробуйте запустить yarn global add npm и вуаля – исправлено!

    В MS Windows решение состоит в том, чтобы удалить %APPDATA%npm и переустановить node

    У меня тоже было это, после вчерашнего brew install yarn . По крайней мере, до этого все было хорошо.

    Я запустил rm -rf node_modules и попытался переустановить, но команда npm не работала.

    В итоге я сделал довольно простой шаг по переустановке Node через официальный установщик Node для Mac OS X.

    Теперь все в порядке. Просто вернулась в каталог, запустила npm install , и это сделало трюк.

    В Arch Linux, что для меня было трюк:

    Просто столкнувшись с этим в Arch Linux 4.13.3, я решил проблему, просто переустановив semver :

    На самом деле, это ссылка на ранее сохраненные модули.

    Решение: Удалите папку npm-cache/npm в установочном каталоге nodejs. В Windows это находится в C: /User/Имя пользователя /Appdata/Roaming/npm (или npm_cache). и попробуйте установить снова.

    То же самое делать в любой ОС.

    В Windows снова загрузился Node MSI, и выполнение “ремонта” сработало для меня.

    Столкнулся с этой проблемой, когда я запустил npm install с использованием более низкой версии узла. Позже, когда я обновил до последней версии узла и запустил gulp , он показал эту ошибку.

    Для устранения удалил node_modules и перезапустил npm install . Тогда gulp побежал нормально.

    Просто удалите папку / node_modules и повторите попытку.;)

    Вы можете использовать npm rm , чтобы удалить его.

    Вы также можете проверить эту проблему на GitHub.
    Чтобы быть более конкретным о неустойчивости, попробуйте следовать this:

    Так грустно видеть, что ты уходишь.

    sudo npm uninstall npm -g Или, если это не удается,

    sudo make uninstall Более серьезная деинсталляция

    Обычно вышеуказанные инструкции являются достаточными. Это удалит npm, но оставьте все, что вы установили.

    Если вы хотите удалить все установленные вами пакеты, то вы можете использовать команду npm ls, чтобы найти их, а затем npm rm to удалите их.

    Чтобы удалить cruft, оставленный позади npm 0.x, вы можете использовать включенный файл clean-old.sh script. Вы можете запустить его так:

    npm изучить npm -g-sh скрипты /clean -old.sh npm использует два файлы конфигурации, один для конфигураций для каждого пользователя и другой для глобальных (каждый пользователь). Вы можете просмотреть их, выполнив следующие действия:

    npm config get userconfig # defaults to

    /.npmrc npm config get globalconfig # defaults для /usr/local/etc/npmrc Удаление npm делает не удалять файлы конфигурации по умолчанию. Вы должны удалить их самостоятельно, если вы хотите, чтобы они ушли. Заметим, что это означает, что будущие установки npm не будут помнить настройки, которые у вас есть выбраны.

    У меня была такая же проблема, но она была вызвана сломанным package-lock.json файлом.

    Удаление package-lock.json и запуск npm install снова исправили его для меня.

    Я, наконец, понял это! Да, вам нужно удалить/удалить все файлы и переустановить. НО НЕКОТОРЫЕ ИЗ ФАЙЛОВЫХ ПУТЕЙ ДОЛЖНЫ УДАЛИТЬСЯ В ПРОЦЕССЕ УНИЧТОЖЕНИЯ. Пути файлов настолько длинны в Node, что их невозможно удалить. Вы должны переименовать пути к файлам.

    После удаления Node используйте Командную строку, перейдите к…Appdataroaming(используйте путь из сообщения об ошибке). Попробуйте удалить папку с del npm. Затем, если он не позволяет вам удалить папку, начните переименование папок в пути к файлу в следующем сообщении об ошибке “a” или что-то короткое. Возможно, вам придется сделать это для нескольких папок по пути. Тогда вы сможете удалить! Затем переустановите Node и он должен работать.

    В моем случае просто перезапуск brew install yarn исправил проблему.

    Я столкнулся с такими же проблемами после того, как brew установил пряжу на мои MacOs Sierra 10.12.6. (И первая попытка установки упадет после brew обновить себя с сообщением “Homebrew должен быть запущен под Ruby 2.3! Вы используете 2.0.0 (RuntimeError)”. Поэтому я перезапускаю его.)

    Поэтому я использую n manager для переустановки npm.

    • переключиться на другую версию node (для моего случая до 8.0) с помощью команды “n” с пустыми параметрами
    • или установите новый с помощью “n x.x.x”, где x.x.x номер версии node (мне нужно 6.9.1)
    • удалить рабочую версию с помощью “n rm x.x.x”, где x.x.x номер версии node. использовать sudo при необходимости
    • установите рабочую версию на “n x.x.x”, где x.x.x номер версии node. использовать sudo при необходимости
    • переключитесь на рабочую версию node. (см. первый шаг для справки)

    Я думаю, что проблема может быть вызвана тем, что node был установлен в sudo для случая.

    Для пользователей Mac я попытался установить кучу новых версий узлов и удалить разные. Это не исправило это. Вы должны полностью стереть все ваши установки в первую очередь. Следуйте этим инструкциям… Как полностью удалить Node.js и переустановить с самого начала (Mac OS X).

    Затем загрузите последнюю версию узла.

    У меня была такая же проблема при установке на AWS Linux. Я должен был установить его с помощью sudo . Поэтому, чтобы обойти это, я выполнил шаг 3 из этой статьи (чтобы получить последнюю версию узла)

    Но установил его в домашний каталог пользователя /home/aUser/node . Затем добавил этот путь в мой путь.

    После этого я смог npm install без проблем.

    Я столкнулся с этими проблемами при запуске проекта на более высокой версии cli. Чтобы решить эту проблему, вы можете просто закомментировать модуль @angular-devkit/build-angular и снова вам нужно переустановить его через

    npm install @angular-devkit/build-angular –save

    Просто убедитесь, что установлен semver : npm install -g semver

    В моем случае на macOS (10.13.6), когда я выполнил следующую команду

    Я получил эту ошибку

    Ошибка была устранена после выполнения команды

    Просто проверьте ваши предустановочные скрипты, если они у вас есть. Иногда, чтобы ограничить версии node и npm нужно запустить проект.

    В этом случае вам нужно установить semver вручную через npm install -g semver

    Я столкнулся с той же проблемой и исправил ее, обновив версию Node

    Источник

    npm: cannot find module semver error while using npm command in linux ubuntu [duplicate]

    This post was edited and submitted for review last year and failed to reopen the post:

    Original close reason(s) were not resolved

    When I use npm, I get this error. Every npm command ends up showing the following error (Ubuntu 20.04):

    2 Answers 2

    I simply reinstalled all Node.js versions and the error is gone!

    Edit: The error caused by using yarn and npm simultaneously. By removing one of them the problem should be resolved.

    If you run an npm command to start your code, one of the things your code will do is to fetch the module from the require(») line in your code. However the issue is, it’s fetching a module named semver but it can’t find it. It likely means it isn’t installed. Try running npm install semver

    Linked

    Hot Network Questions

    Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.1.14.43159

    By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

    Источник

    Установка Npm не может найти модуль ‘semver’

    Я не могу использовать npm install с помощью командной строки в NodeJS. Я получаю эти ошибки при запуске npm install :

    У меня была такая же ошибка. npm uninstall npm -g , rm -rf node_modules не помогло мне, потому что, когда я пытался, я получал Error: Cannot find module ‘semver’ . Но я решаю свою проблему с этими шагами (это удалит другие глобальные модули, которые вы можете использовать):

    • sudo rm -rf /usr/local/lib/node_modules
    • sudo rm -rf

    /.npm

  • brew uninstall —force node
  • brew install node
  • Надеюсь, что это поможет тем, кто получает подобную проблему.

    Я сталкиваюсь с той же проблемой здесь.

    Если это происходит сразу после запуска, brew install yarn попробуйте запустить yarn global add npm и вуаля — исправлено!

    В MS Windows решение состоит в том, чтобы удалить %APPDATA%npm и переустановить node

    У меня это тоже было после brew install yarn вчерашнего бега . По крайней мере, до этого все было хорошо.

    Я побежал rm -rf node_modules и попытался переустановить, но ни одна npm команда не работала.

    В конце я сделал довольно простой шаг переустановки Node через официальный установщик Node для Mac OS X.

    Теперь все хорошо. Просто вернулся в каталог, побежал, npm install и он сделал свое дело.

    В Arch Linux то, что помогло мне, было:

    Просто столкнувшись с этим в Arch Linux 4.13.3, я решил проблему, просто переустановив semver :

    На самом деле, это ссылка на ранее сохраненные модули.

    Решение: Удалите папку npm-cache / npm в установочном каталоге nodejs. В Windows это находится в C: / User / Имя пользователя / Appdata / Roaming / npm (или npm_cache). и попробуйте установить снова.

    То же самое нужно сделать в любой ОС.

    В моем случае на macOS (10.13.6), когда я выполнил следующую команду

    Я получил эту ошибку

    Ошибка была устранена после выполнения команды

    Для меня это произошло после того, как я установил пряжу по всему миру. Чтобы решить эту проблему, установите npm, используя пряжу, и готово.

    В Windows загрузка MSI Node снова и выполнение ‘Repair’ работали для меня.

    У меня была такая же проблема, но она была вызвана сломанной package-lock.json файлом.

    Удаление package-lock.json и запуск npm install снова исправили это для меня.

    Столкнулся с этой проблемой, когда я бежал, npm install используя более низкую версию узла. Потом, когда я обновил до последней версии узла и запустил gulp , он показал эту ошибку.

    Для устранения удалил node_modules и перезапустил npm install . Тогда gulp побежал нормально.

    Просто удалите папку / node_modules и попробуйте снова. 😉

    Вы можете использовать, npm rm чтобы удалить его.

    Вы также можете проверить эту проблему на GitHub. Чтобы быть более точным в отношении unisistal, попробуйте выполнить следующее :

    Так грустно видеть, как ты уходишь.

    Судо npm uninstall npm -g Или, если это не удается,

    sudo make uninstall Более серьезная деинсталляция

    Обычно приведенных выше инструкций достаточно. Это удалит npm, но оставит позади все, что вы установили.

    Если вы хотите удалить все установленные вами пакеты, вы можете использовать команду npm ls, чтобы найти их, а затем npm rm, чтобы удалить их.

    Чтобы удалить оставшуюся часть с npm 0.x, вы можете использовать включенный файл сценария clean-old.sh. Вы можете запустить его так:

    npm explore npm -g — sh scripts / clean-old.sh npm использует два файла конфигурации, один для пользовательских настроек, а другой для глобальных (для каждого пользователя). Вы можете просмотреть их, выполнив:

    Конфигурация npm get userconfig # по умолчанию

    / .npmrc Конфигурация npm get globalconfig # по умолчанию / usr / local / etc / npmrc Удаление npm по умолчанию не удаляет файлы конфигурации. Вы должны удалить их самостоятельно, если хотите, чтобы они исчезли. Обратите внимание, что это означает, что будущие установки npm не будут помнить выбранные вами настройки.

    Источник

    I get the following error when I try to run npm command

    root@localhost:# npm --version
    internal/modules/cjs/loader.js:584
        throw err;
        ^
    
    Error: Cannot find module &apos;semver&apos;
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
        at Function.Module._load (internal/modules/cjs/loader.js:508:25)
        at Module.require (internal/modules/cjs/loader.js:637:17)
        at require (internal/modules/cjs/helpers.js:22:18)
        at Object.&lt;anonymous&gt; (/usr/share/npm/lib/utils/unsupported.js:2:14)
        at Module._compile (internal/modules/cjs/loader.js:701:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
        at Module.load (internal/modules/cjs/loader.js:600:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
        at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    Aborted
    

    I’ve tried uninstalling and re-installing npm and nodejs, but i still get the error

    How can i fix this?

    DavidPostill's user avatar

    DavidPostill

    149k77 gold badges344 silver badges383 bronze badges

    asked May 17, 2019 at 19:27

    Clid3's user avatar

    1. I manually uninstalled node and npm:
      sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules 
      
      sudo rm -rf /usr/local/lib/node* ; sudo rm -rf /usr/local/include/node* ; sudo rm -rf /usr/local/bin/node*
      
      sudo apt-get purge nodejs npm
      
    2. I re-installed node and npm manually by downloading from Node.js:
      tar -xf node-v5.9.0-linux-x64.tar.xz
        sudo mv node-v5.9.0-linux-x64/bin/* /usr/local/bin/
        sudo mv node-v5.9.0-linux-x64/lib/node_modules/ /usr/local/lib/
      
      # Verify installation:
        node -v ; npm -v
      

    JW0914's user avatar

    answered May 18, 2019 at 21:58

    Clid3's user avatar

    Clid3Clid3

    611 gold badge1 silver badge4 bronze badges

    Понравилась статья? Поделить с друзьями:
  • Ubuntu error 0x800701bc
  • Ubuntu device descriptor read 64 error 32
  • Ubuntu chroot exec format error
  • Ubuntu busybox initramfs как исправить
  • Ubuntu apt update error