NodeJS Error: Cannot find module './lib/oauth' - node.js

After cloning my test site from github and succeeding to remove the default version of node on my raspberry pi 3 and installing V8.5.0, I ran npm install and npm install nodemon -g. Now however I am unable to run my script due to an error:
module.js:529
throw err;
^
Error: Cannot find module './lib/oauth'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object. (/home/pi/Projects/EncodedB0t/node_modules/request/request.js:28:13)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
I've tried adding npm install oauth --save to no avail and haven't been able to find an answer online.
Any help would be appreciated!
Edit: added my github repo, https://github.com/TheWalkingM3m3/EncodedB0t

Try run npm install request --save. Then rename oauth.js.example in your root directory on oauth.js. It's works in my case.

Related

Internal/modules/cjs/loader.js: 584 error

I am facing an error when I am running npm commands for running a umi app project. This is the error I see when I run the code.
I have tried checking the node module for the loader.js file but I have not been able to find it.
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module '#nodelib/fs.stat'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\cyhc9\umiapp\node_modules\fast-glob\out\adapters\fs-stream.js:17:14)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
The code should run when I run npm commands or the project commands.
Possible solutions:
Try not to have space in your directory name, i.e.: fun project/nestjs/..., try this: fun-project/nestjs/....
Remove node_modules and package-lock.json then do npm install again to see if that solve the problem.
Clear node cache by npm cache clean --force then repeat step number 2.
Keep trying npm i again.
Buy a new computer.
Good luck.

npm cannot run in Debian: Error: Cannot find module 'node-uuid'

Not really good with this JavaScript world. Trying to install npm and I think it's broken. I'm using Debian and ran:
apt install npm.
Everything went fine but when I run npm it throws up this error
module.js:538
throw err;
^
Error: Cannot find module 'node-uuid'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/lib/nodejs/request/index.js:29:12)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
Nothing works, i can't install the node-uuid either.
I fixed this, I think there's a problem with the package on Debian repo.
I followed the instruction on Node website
https://nodejs.org/en/download/package-manager/
I have npm installed now :)

How to install: caress server node server.js . Error: 'Cannot find module '....buffertools.node'

I am installing the the library found from MIT students using TUIO. According to their instructions I was supposed to start the server but I got an error.
Does anyone know how to fix this error?
C:\Users\PC\Desktop\server1.1>node examples/server.js
info - socket.io started
module.js:442
throw err;
^
Error: Cannot find module './build/Debug/buffertools.node'
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:\Users\PC\Desktop\server1.1\node_modules\buffertool
s\buffertools.js:26:20)
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)
I tried following there steps and got my server stared.
I think you are missing npm i after cloning repo.
please do npm i and try starting server
You need to install the dependency packages before you can run your project.
npm install looks for the packages listed in the package.json file and installs them with their dependencies recursively.
If you are getting specific error in installation of particular package, it could be internet issue/os issue and most probably node and npm version issue. Make sure you are using a stable version of node, its version no should be even.

node.js returns "Cannot find module 'lockit-mongodb-adapter'"

I am going through my first node.js project. I've installed lockit , have a app.js file, and when I try to run it I get this error
module.js:340
throw err;
^ Error: Cannot find module 'lockit-mongodb-adapter'
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 new module.exports (C:\Users\xx\Documents\mailer\index.js:38:44)
at Object.<anonymous> (C:\Users\xx\Documents\mailer\examples\mongodb\app. js:32:14)
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)
I am quite certain I have lockit-mongodb-adapter installed.
You need to install the module. Cd to the root of your app directory and run this command and make sure lockit-mongodb-adapter is in your node modules directory.
npm install lockit-mongodb-adapter
Another thing you can do if you are certain it is installed is double check to see what is installed by running this command:
npm list
And this one to see what is installed globally:
npm list -g
Update:
I was able to reproduce the issue you where having. And to resolve it I deleted the module from the node moules directory. And re-installed with the following command:
npm install lockit-mongodb-adapter -save
It now shows up in npm list with no issues:

Cannot find module 'node-gcm'

Im attempting to get Push notifications working with Android. Im following the tutorial here. It require installation of the node-gcm module of node.js. I installed this with the following command:
sudo npm install -g node-gcm
I have a file called notify.js. I run this with:
node notify.js
But I'm always getting the error:
module.js:333
throw err;
^
Error: Cannot find module 'node-gcm'
at Function.Module._resolveFilename (module.js:331:15)
at Function.Module._load (module.js:273:25)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at Object.<anonymous> (/var/www/PushPlay/notify.js:1:73)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:349:32)
at Function.Module._load (module.js:305:12)
at Function.Module.runMain (module.js:490:10)
Any ideas?
If you've done a global install of the module, sometimes you need to create a symlink to the global module. Try npm link node-gcm.
Also try and install node-gcm without the global switch (npm install node-gcm), if it works locally you'll know it's an issue with the global install.

Resources