Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm completely won't work: "Error: Cannot find module 'isarray'"

So every time I try us any npm command I get the same error:

module.js:472
throw err;
^

Error: Cannot find module 'isarray'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:32:15)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

Even when I try running npm install isarray I get the same exact error. I've tried uninstalling the dependencies and then running npm install and I get the same error. I've tried completely reinstalling npm AND node and I still get the same error.

If I need this package to install this package I don't know what else to do.

like image 734
jsteele Avatar asked Mar 03 '18 16:03

jsteele


1 Answers

In my case, this was cause of node and npm version.

Try to update your node and npm version.

First, Node update is

//Clean node Cache

sudo npm cache clean -f

//Install n Module

sudo npm install -g n

//Install stable Node version Using n Module

sudo n stable

IF this is not worked, then use 'nvm' (In my case, below is worked.)

nvm install 8.10.0

You can check your node version by 'node -v'

Second, npm update.

sudo npm install -g npm

You can also check your npm version by 'npm -v'

I hope this will be helpful!

like image 194
007 Avatar answered Oct 31 '22 00:10

007