I have installed node js on my windows 10 machine, and the version is v4.4.2 but when I try to run npm install or even check npm version it throwing the following error. Any help would be greatly appreciated
Error: Cannot find module 'readable-stream'
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.<anonymous> (C:\Users\nmadasu\AppData\Roaming\npm\node_modules\npm
\node_modules\are-we-there-yet\index.js:2: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)
Also, after reading other solutions to this problem, npm install gulp -g, npm install 'readable-stream' or any other suggestion I read and tried did not work. It appears any command I try with npm throws the error below.
Error: Cannot find module 'readable-stream'
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.<anonymous> (C:\Users\nmadasu\AppData\Roaming\npm\node_modules\npm
\node_modules\are-we-there-yet\index.js:2: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)
I have also tried uninstalling node and reinstalling and same issue persists.
I figured it out, when I uninstalld I did not delete all the files. There were the node/npm files in my C: directory and failed to realize there were a bunch of npm module files in my / directory. So after uninstalling and deleting all related files I reinstalled node/npm and it is now working.
After all the checks its clear you need to uninstall and re-install node:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable // for stable version
sudo n 0.12.7 // for specific version like v0.12.7
// check the node version after install
node -v
If you are on windows make sure after you Uninstall node you %appdata% or C:\Users\admin\AppData\Roaming and delete all the npm folders that have been created here by your previous install.
git clone https://github.com/nodejs/readable-stream into global node_modules folder
Related
I have installed node-properties-parser globally by running npm install -g node-properties-parser as normal user(vaisakh). Then i ran my test.js file with the command node test.js now it's throwing the error
Error: Cannot find module 'node-properties-parser'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/data02/bamboo/test.js:3:12)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
I ran the above npm install -g node-properties-parser as root user and run the node test.js here it's working fine. But why it's throwing the error while running as normal user?
Thanks. Finally i found the answer, it's working when in run sudo npm install node-properties-parser without the -g option. But still i don't know why the -g option is not woking, in the docs it's given as install globally.
I am starts working on expressJs nodeJs but stuck at a beginning point to run the node server.js command. I think any module is missing to install but i`m not recognize which one is missing.Im working on linux(ubuntu) operating system. Please help me to out this problem.
iron#iron-System-Product-Name:/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/admin-panel/node-admin-master$ node server.js
module.js:442
throw err;
^
Error: Cannot find module '/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/admin-panel/node-admin-master/config/env/undefined'
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> (/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/admin-panel/node-admin-master/config/routes.js:6:14)
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> (/media/iron/1d6c195f-2350-423c-a3f0-0500c92e580a/admin-panel/node-admin-master/server.js:14:13)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
Node Version: v6.2.2
Npm version: 3.9.5
it take undefined of variable which may you declare in config/env/undefined.
Please check your env file or if possible share with me .
Thanks
With the error, i suspect you are missing iron-node module.
To simply install in project, run
npm i iron-node
to install and save it in the project's package.json, run:
npm i iron-node --save
to install it in your computer, do:
npm i -g iron-node
However, since this is a development dependency, you should install it as one and save it in package.json, by:
npm i iron-node -D --save
I honestly dont even know what question I should be asking here, but npm run build fails
> color-organizer#1.0.0 build /home/francis/Desktop/react/chapter-
06/color-organizer
> webpack --progress
module.js:471
throw err;
^
Error: Cannot find module 'set-blocking'
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> (/home/francis/.nvm/versions/node/v5.0.0/lib/node_modules/webpack/node_modules/yargs/lib/usage.js:5:21)
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)
node -v gives me
v6.11.0
so its weird that i see 5 in this error log. I do need to note that i was running on 5 before, and just recently upgraded to 6.11 in the middle of this problem
i'm on ubuntu 16.04
i'm just trying to follow these examples https://github.com/MoonHighway/learning-react/ and start a server for 6, but i can't
and its pissing me off
Running npm install fixed the error for me using the latest versions. Otherwise you may try the command npm install set-blocking or npm install set-blocking --save-dev to only install the module as a developer dependency.
I'm trying to run some NodeJS code using Sharp and i'm getting the following error:
[root#localhost myapp-backend]# node server.js
module.js:340
throw err;
^
Error: Cannot find module './build/Release/sharp'
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 Object.<anonymous> (/root/myapp-backend/node_modules/sharp/index.js:11:13)
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)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/root/myapp-backend/server.js:277:13)
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)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:935:3
Any ideas?
Thank you.
Turns out the Debian 8.x distribution I used did not include vips but I did not get an error message. Running
apt-get install libvips
followed by
npm install sharp
resolved the problem and sharp is finally installed and working.
It's probably due to Sharp not getting installed. When I installed it via
npm, there were no errors, but when I went into node_modules/sharp, three were no build files.
You can try to build it by doing
node-gyp rebuild
But, before that, make sure you have Vips installed - that's a lib that Sharp uses. On Mac you'd do
brew install homebrew/science/vips --with-webp --with-graphicsmagick
After you build the Sharp library, you should be good to go.
Check if you don't have build folder on node_modules/sharp, then run:
npm i sharp
it will reinstall and builds sharp. (worked for me)
I was getting the same error in Lambda function for s3 image crop.
I installed the sharp module as below and I was able to crop images using Node.js 14.x version.
npm install --platform=linux --arch=x64 sharp
Please check "node_modules/sharp/build/Release/" folder for "sharp-linux-x64.node"
In my case installing the sharp for specific target version of node.js works, I used below command, but before that remove your existing node_modules folder or remove rm -rf node_modules/sharp
npm install --arch=x64 --platform=linux --target=16x sharp
What worked for me was updating to the latest Node 13 instead of the Node 8 that apt-get provides by default. Answering just for future reference.
My code was working previously before, but seems to have stopped working. I tried yo angular:route api but this error was returned:
Error: Cannot find module 'ansi-styles'
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 Object.<anonymous> (/usr/local/lib/node_modules/generator-angular/node_modules/chalk/index.js:2:12)
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)
at Module.require (module.js:364:17)
I have added all the dependencies required to my package file, update npm (which is now on 2.0.0alpha), all npm packages, and ran npm install. The site still works when I grunt serve.
(The O.P.):
I found the reason I got the error. I had to change the npm root folder and reinstalled my packages in the default folder and now it works.
Just needed to run npm install here. Was a fresh clone out of Git.
Installing the module globally working for me.
npm install ansi-styles -g