Error: Cannot find module 'internal/linkedlist' in WebStorm - node.js

I have a script that runs fine when I run it in terminal with node, but using WebStorm I can't properly run it as it crashes on a dependency require line.
I've attempted to npm install internal/linkedList, I've also attempted to npm cache clean (as recommended in another post).
The full stack trace is:
Error: Cannot find module 'internal/linkedlist'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/harshagoli/Library/Preferences/WebStorm2017.2/javascript/nodejs/8.1.4/core-modules/timers.js:26:11)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)

Related

What is module.js 540 throw error?

Just installing node/npm first time, Linux Fedora: I've followed all the instructions and tried every fix I can find on google.
Whenever I try to run npm install or npm test I get this:
module.js:540
throw err;
^
Error: Cannot find module 'npmlog'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at /usr/lib/node_modules/npm/bin/npm-cli.js:22:13
at Object.<anonymous> (/usr/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
It was a bug and it has already been fixed in Node v5.4.1. Now it's working as usual.

ng serve: Cannot find module 'tapable'

I just transfered my Angular 5 project from one computer to another and in the new device I get the following error when trying to ng serve:
Cannot find module 'tapable'
Error: Cannot find module 'tapable'
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.<anonymous> (c:\xampp\node_modules\webpack\lib\Template.js:7:17)
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)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (c:\xampp\node_modules\webpack\lib\node\NodeMainTemplatePlugin.js:5:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
I tried to:
Remove node_modules and run again npm install.
npm install tapable
My node version is 6.11.2 with npm 5.3.
Any idea what can solve it?
Fix: I had to manually npm install webpack in order to solve this issue.

Updating node.js possibly lead to npm error

I recently updated the node.js to the version 6.11.1. Got an error when accessing npm
When I tried to check the version of npm, the following error occurs
$ npm -v
module.js:471
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
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 C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:19:21
at Object.<anonymous> (C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:92:3)
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)
After getting this error I updated the node.js to the latest version 8.1.4.
and the error is same with different line numbers.
$ npm -v
module.js:487
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:19:21
at Object.<anonymous> (C:\Users\dino\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:92:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
What is happening? Any fix to this issue?
At last, I got the solution.
I have copied all contents from
C:\Program Files\nodejs\node_modules\npm
and pasted it in
C:\Users\dino\AppData\Roaming\npm\node_modules\npm

gulp dev cant be run because of mistake

I run npm install in the project's root and then when I try to run gulp de, I get the following mistake:
$ gulp dev
module.js:442
throw err;
^
Error: Cannot find module './lib/public/public-utils'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\ente\node_modules\browser-sync\index.js:9:21)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\ente\gulpfile.js:27:21)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Liftoff.handleArguments (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:116:3)
at Liftoff.<anonymous> (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js :193:16)
at module.exports (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\flagged- respawn\index.js:17:3)
at Liftoff.<anonymous> (C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js:185:9)
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\liftoff\index.js: 159:9
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\v8flags\index.js:108:14
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\v8flags\index.js:36:12
at C:\Users\Man\AppData\Roaming\npm\node_modules\gulp\node_modules\v8flags\index.js:47:7
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:577:11)
at run (bootstrap_node.js:352:7)
at startup (bootstrap_node.js:144:9)
at bootstrap_node.js:467:3
the gulp file
i tried different things, like to go to an older node, to the latest one, reinstalled node, npm and gulp billions of times, but it didnt help.
What can it be and how to fix it?
The error seems to happen when you require the browser-sync module in your gulpfile. The module doesn't find one of it's own components ./lib/public/public-utils and can't start.
I'd first check in your node_modules directory to see what's going on with browser-sync.
It's usually a corrupted install of the module.
Make sure that in your package.json you have browser-sync listed with the most up-to-date version (2.13.0) and to get a fresh install delete your node_modules directory, npm cache clean
and run npm install again.

NodeJS Error: Module version mismatch. Expected 48, got 46

After I upgraded NodeJS and NPM to 6.2.0 and 3.9.3, when I run hexo d -g command to update my blog, I get the following error:
Error: Module version mismatch. Expected 48, got 46.
at Error (native)
at Object.Module._extensions..node (module.js:568:18)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/dtrace-provider/dtrace-provider.js:17:23)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/bunyan/lib/bunyan.js:79:18)
{ Error: Cannot find module './build/default/DTraceProviderBindings'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/dtrace-provider/dtrace-provider.js:17:23)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/bunyan/lib/bunyan.js:79:18)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/Debug/DTraceProviderBindings'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/dtrace-provider/dtrace-provider.js:17:23)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/hexo-cli/node_modules/bunyan/lib/bunyan.js:79:18)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32) code: 'MODULE_NOT_FOUND' }
(node) v8::ObjectTemplate::Set() with non-primitive values is deprecated
(node) and will stop working in the next major release.
I thought maybe Node.js is upgraded and node_modules should be reinstalled.
I tried rm -rf node_modules && npm install, but it doesn't work. I also tried sudo npm i -g npm then npm install hexo --no-optional --save, which doesn't work neither.
Any advice would be most appreciated.
Actually, after upgrading node, your installed packages kept compiled against the older version, and they need to be rebuilt. No need to delete node_modules, or running npm update.
Just run:
npm rebuild
Hexo doesn't seem to work with lastest version of node which is 6.2.0. You should use node-v4.4.5 (LTS) for a while, which is recommended version for most users.
It looks like hexo is a globally installed package, but you only reinstalled it locally. Try to reinstall it globally:
npm install hexo -g
Maybe your Global installation files has not been update, please try to update your hexo-cli with command below:
sudo npm install -g hexo-cli
which solved my problem.

Resources