node.js terminal error. (MAC) - node.js

I've downloaded node.js and have already checked if it's installed by typing node -vinto the terminal. I already found a question which was almost the same as mine, but their answer didn't work at all.
Anyways, my problem is that I can't get .js files to open with node.js. When I type node automatic.js it responds with this (I put #FULLNAME instead of my actual full name):
Maxs-MBP-2:desktop #FULLNAME#$ node automatic.js
module.js:327
throw err;
^
Error: Cannot find module './app/logging.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/#FULLNAME#/Desktop/automatic.js:1:73)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
I'm sorry if this is actually an easy fix, I'm new to all of this. This is also my first post on Stackoverflow. Hello, world! Thank you so much!
~Max

Related

aws-sdk error in expressjs project - Cannot find module 'aws-sdk/lib/config_service_placeholders

Everything worked fine then suddenly I got an error that crashes my app before start.
I don't know from where error came when everything worked fine a day before
Error: Cannot find module 'aws-sdk/lib/config_service_placeholders'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (D:\projects\chatRush\controllers\userController.js:7:46)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (D:\projects\chatRush\routes\basicRoutes.js:6:24)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)```
I had the same problem and the solution was embarrassingly simple. I use Visual Studio Code and had accidentally imported a bad, unused file.
Going over your files mentioned in the error output and see if you have imported the wrong file :)
Hope you find it!
If no code changed, the problem is probably corrupted node modules. First step would be removing your node_modules and reinstalling them.
There could also be with a problem with the import statement in your userController.js line 7.

Npm command doesn't work anymore

Whenever I try to run the npm command I end up with the following:
module.js:327
throw err;
^
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\decraejo\AppData\Roaming\npm\node_modules\npm\node_modules\npmlog\node_modules\are-we-there-yet\index.js:2:14)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
I found this article, but their solution doesn't seem to work for me:
https://github.com/npm/npm/issues/6366
#deepakvasa Very helpful advice! I've also met with this problem and solve it by remove node_modules and reinstall npm
Where should I remove the node_modules from?
For me, this was due to an incorrect installation attempt of npm that I had attempted. Just go to: "drive_name":\Users\"your_user_name"\AppData\Roaming\npm and remove the node_modules folder. Then try again. Did it for me!
Cheers!

Error: Cannot find module 'indexof' in node.js

I am trying to use nodejs for a application, i am continuously getting the
error: Cannot find module.
module.js:340
throw err;
^
Error: Cannot find module 'emitter'
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> (/home/nilesh/node/node-v0.10.32/prgm/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/socket.io-parser/index.js:9:15)
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 tried installing one, but the other comes up, and this is continuous. Is there something which can be done to this, i tried doing this
npm install -g emitter,
it prints the path where it is present but it is not solving the issue.What could be the solution to this.
Thanks,
You probably want:
var Emitter = require('events').EventEmitter in your code
or
npm install emitter from the commandline.
I don't know why you're trying to install indexof, the error is about emitter.

yeoman angular generator wont start on grunt serve

When I set up the angular generator with yeoman I get this error after doing grunt serve
module.js:340
throw err;
^
Error: Cannot find module './lexer'
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> (/var/www/angMaps/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/coffee-script.js:10:10)
at Object.<anonymous> (/var/www/angMaps/node_modules/grunt/node_modules/coffee-script/lib/coffee-script/coffee-script.js:167:4)
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)
As #SteveBirkner already mentioned, delete the node_modules directory and run npm install command again. It should work.
I had the same problem, and in the end of the log I was receiving such a message:
...
http 200 http://registry.npmjs.org/-/all
Killed
The problem was the lack of enough memory in my VM. One solution was to use swap is mentioned here.

module.js:340 throw err cannot find module articleprovider-mongodb.js

I've uninstalled and reinstalled it three times and cleared the cache, but it's still not finding this file.
I tried creating an articleprovider-mongodb.js file from one I found online, but no joy. Here's my error message:
module.js:340
throw err;
^
Error: Cannot find module './articleprovider-mongodb.js'
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> (/home/action/blog/app.js:6:23)
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)
When I created a new nitrous box and redownloaded everything (and I mean everything--stylus, express, mongo, etc) it worked. Don't ask me how or why, I'm just going with it.

Resources