npm completely won't work: "Error: Cannot find module 'isarray'" - node.js

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.

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!

Related

Cannot find module './build/Debug/DTraceProviderBindings'

I know this question has been asked lots of times like
here and here.
I have tried all suggestions on these links and more..
I tried installing the latest bunyan
sudo npm install bunyan#1.8.12 --unsafe-perm=true --allow-root
I installed and rebuilt latest dtrace-provider
sudo npm install dtrace-provider#0.8.7 --unsafe-perm=true --allow-root
sudo npm rebuild dtrace-provider#0.8.7 --unsafe-perm=true --allow-root
it built the module successfully.
+ NODE_GYP_STATUS=0
+ [[ 0 -ne 0 ]]
+ exit 0
touch Release/obj.target/ndtp.stamp
npm WARN swaggerize-express#4.0.5 requires a peer of express#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tr-stack#1.0.0 No repository field.
+ dtrace-provider#0.8.7
In spite of that I am still getting this error:
Error: Cannot find module './build/Release/DTraceProviderBindings'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/yogeshsingh/TradeRev/code/tr-stack/node_modules/vogels/node_modules/dtrace-provider/dtrace-provider.js:17:23)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
node version and npm version are as follows:
node: v11.6.0
npm : 6.5.0

Error: Cannot find module 'commander'

when I m running sails -v, sails lift or even installing npm I m getting this error Please help -
Error: Cannot find module 'commander'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/sails/bin/_commander.js:6:15)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
Most likely commander is missing from package.json. Install it and add it to package.json by doing:
npm install commander --save
Install commander globally.
sudo npm install commander -g
This will install commander module under/usr/lib/node_modules/.
Uninstalling sails and reinstalling with 'sudo' resolved it.
npm uninstall sails -g
sudo npm install sails -g
When i try setup new app with the help of express-generator.
given error:Cannot find module 'commander'
Node version:12.16.1
switch node version :10.16.3
after switch node version is working fine..
In my case it was because of bad version of node. I've tried node 8.15.1 and it works.
On my end, after doing npm install, and attempt to run npm run watch I encountered this same issue of Error: Cannot find module 'commander'.
I did below:
// delete node_modules (can do manually) or command below
// rm -rf node_modules
npm install
And I was able to do npm run watch again.
This maybe because of corrupted packages.

npm Error “ Cannot find module 'npmlog' ”

I am running CentOS 6 and after logging in, I encounter the following error
module.js:340
throw err;
^
Error: Cannot find module 'npmlog'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /home/dspace/.nvm/v0.10.31/bin/npm:19:11
at Object.<anonymous> (/home/dspace/.nvm/v0.10.31/bin/npm:87:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `npm config delete prefix` or `nvm use --delete-prefix v0.10.31 --silent` to unset it.
I've discovered that it is a version bug and can be resolved either by upgrading the npm version or by deleting the node modules like so;
rm -rf node_modules
Then reinstalling them;
npm install
After removing the modules, npm install failed to run because of missing dependancies i.e. the modules. Now the command shows no response at all.
My node version is v0.10.48
This worked for me
Install nvm:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
Restart the terminal
Run
nvm install node
 
I had the same problem after proposed npm upgrade via npm -i -g npm. But Fedora npm/node installed via dnf has modules links to /usr/lib/node_modules/npm/node_modules.bundled/ from /usr/lib/node_modules/npm/node_modules/. I saw links were broken because usr/lib/node_modules/npm/node_modules.bundled/ disappeared. So reinstallation node,nodejs,npm via dnf/rpm solved the problem.

error cannot find module 'umask'

I just installed nodejs x64 on my Windows 10 computer. I keep all default config,
I open cmd and type:
npm -v
Then i got following error:
module.js:457
throw err;
^
Error: Cannot find module 'umask'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\W10-PRO\AppData\Roaming\npm\node_module\npm\lib\utils\umask.js:1:75)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
Every command start with "npm" create this error and npm cannot uninstall, update itself)
Please help me fix this error?
update your npm
$ npm install npm -g
I would try to update/install NPM
$ npm update -g npm
I know the answer!
Uninstall nodejs.
Delete all references to npm and nodejs (Program Files, Program Files(x86).
Then also delete those in AppData/Roaming (npm and npm-cache to be sure).
Reinstall nodejs.
It works!

bower install - Cannot find module 'q'

I'm using node v5.6.0 and bower 1.7.7 on a Mac.
I've done a npm install in my project folder which installs all the /node_modules including q.
I've also done a npm install -g q just to see if that helped.
But as soon as I run bower install (or just bower) anywhere I get
ambp:~ andreaslarsen$ bower
module.js:341
throw err;
^
Error: Cannot find module 'q'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/usr/local/bin/bower:6:9)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
Any suggestions?
I had this problem recently. I reinstalled bower globally. npm install and
"npm install -g bower" solved my problem. This downloaded the required folders in to node_modules directory globally and solved problem which I faced while installing packages with bower.
Turned out I just had to restart the terminal after doing the npm install and before doing the bower install
Works fine now
I also had this problem too, I tried a new terminal which didn't fix it, so I manually installed the missing module but it refused to find others, so upon further investigation it turned out to be a botched install of bower, which hadn't installed all its libs, so rerunning
npm install
fixed it for me.

Resources