Node server.js not responding and thows error message - javascript

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

Related

Node JS Cannot find module 'node-properties-parser' Error while running as normal user in Amazon Linux

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.

Strange heroku command error

When I run any heroku command or open a page where user is not signed in. This is the only error I'm getting over and over again.
I did remove the Heroku tmp today but I pushed the app fine afterwards, the error suddenly happened.
When i go to the app it opens up if the user is signed in but when opened incognito it has an error, checking the logs it's the same error below
Can anyone help me out on this one?
module.js:491
throw err;
Error: Cannot find module 'universalify'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/ubuntu/.local/share/heroku/client/node_modules/fs-extra/lib/fs/index.js:3:11)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
module.js:491
throw err;
^
Error: Cannot find module 'universalify'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/ubuntu/.local/share/heroku/client/node_modules/fs-extra/lib/fs/index.js:3:11)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
! error getting commands pid 14405 exit 1
Try adding this to package.json and rebuild instanses:
"universalify": "^0.1.1"
or run this command on your server and restart node.js:
npm install universalify --save
I will advice you run these on your terminal in your CWD of the preoject npm uninstall universalify -S --save, which should remove any form of universalify that probably had some missing dependencies during your npm install, after which you can then run npm install universalify --save.
Don't hesitate to comment if you encounter any further challenge.
I was also having this error last time when i'm still doing my project on node . So what i did was . Install every npm that is missing so something like this
npm install universalify --save
If it still persist. Delete the folder of the universalify and reinstall npm again :) . And don't forget to delete it also on your package.json

npm build fails at webpack

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.

npm --> Err: Cannot find module 'readable-stream'

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

bower install not recognizing local npm package?

I am getting the following error upon runing bower install.
$ bower install
module.js:340
throw err;
^
Error: Cannot find module 'minimist'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:289:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/home/ubuntu/.nvm/versions/node/v5.1.0/lib/node_modules/bower/node_modules/bower-config/node_modules/optimist/index.js:2:16)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
I have "minimist" installed as a local npm package but not globally. Is there any way to get bower to recognize the local package and avoid installing minimist globally?
Running npm install -S minimist in a CLI from your project root directory should solve your problem.

Categories