Node.js Cannot find module './internal/streams/stream' - node.js

I get an error when I want to use gulp for deployment.
Error: Cannot find module './internal/streams/stream'
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> (/var/www/pomelo/themes/pomelo/assets/js/node_modules/gulp-replace/node_modules/readable-stream/lib/_stream_readable.js:50: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)
So I use npm install readable-stream, but this is still the error.
Why? How can I fix it?

Try this:
rm -rf node_modules
npm install

What worked for me is to delete the package-lock.json file and the node_modules folder, then run npm install.

It's a core node lib. Try first,
npm cache clean
If not work, reinstall node

Related

Node : Cannot find module common

I was running a node server w/o any issue and for some purpose had to remove the node_modules dir and re-install the dependencies. Upon doing so and running the server again I get this error :
Error: Cannot find module './common'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Work\Cinde-Node\node_modules\debug\src\node.js:236:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
I installed common separately using npm install common but that didnt solve the problem.
How do I fix this ?
It looks like you have a line like
require('./common');
it should be
require('common')
I was getting the same error when I tried running my express project. The following command helped me to fix the issue.
rm package-lock.json && rm -r node_modules && npm i --save --legacy-peer-deps

How to solve ini error for npm

I just install node.js to my system. My node version is v8.10.0. When I try npm -v I get following error.
module.js:549
throw err;
^
Error: Cannot find module 'ini'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\ai8\AppData\Roaming\npm\node_modules\npm\node_modules\config-chain\index.js:4:11)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
How can I fix this issue?
I had a same kind of issue before. I tried all the solutions even tried uninstalling and reinstalling node js. Finally, I tried by removing the node_modules from the user folder.
Then, run npm install.
This worked for me.
Hope it works for you
delete node_modules and reinstall
rm -rf node_modules
npm install
Use this link for further details. Hope this will help you.
npm

Cannot find module 'ansi-regex' | npm not getting uninstalled or updated

I am unable to uninstall or update npm. I tried running rn -rf node-modules, rimraf node-modules, and even manually deleting the npm folder from the system. I even removed the environment variable. Unfortunately, nothing is working.
I uninstalled nodejs and completely removed ALL the folders and temp files. Post system restart, I did a fresh installation of nodejs and when I again tried to install npm, I get this error:
throw err;
^
Error: Cannot find module 'ansi-regex'
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:\Users\Admin\AppData\Roaming\npm\node_modules\npm\n
ode_modules\strip-ansi\index.js:2:38)
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)
Basically, whatever method I tried, I get the same error. Please help!
node version: v6.11.0
OS: Windows 8
I have also tried installing 'ansi-regex' using npm install ansi-regex

the command "npm" returns with an error

*
C:\Users\xxxxx>npm
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:\Users\xxxxx\AppData\Roaming\npm\node_modules\npm\lib\utils\unsupported.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)
C:\Users\xxxxx>
It's saying that it cannot find the module semver.
Try running npm install semver --save
Try running npm install semver --save in your console under current directory where you are starting the node app.
npm install semver --save
works.

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.

Resources