cannot find module 'config-chain' - node.js

This is my first post, so forgive me for formatting issues. I was following this mean.io tutorial: https://www.youtube.com/watch?v=0aMNWYpG5sk. It basically gets you to the point where you can locally access the default web app. I was able to do so successfully.The video then suggests to run>
mean package myTheme
I received this error...
C:\Users\****\myApp>mean package myTheme
module.js:339
throw err;
^
Error: Cannot find module 'config-chain'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (C:\Users\****\AppData\Roaming\npm\node_modules\mean-cli\node_modules\npm\lib\config\core.js:2:10)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
I'm running npm 2.14.7 and node v4.2.3(video uses 4.2.2) on Win 10. I had previously tried this on node 5.3 and received the same error. I also tried cleaning cache & updating npm, bower, and gulp.
I found C:\Users****\myApp\node_modules\config-chain. Do I need to change something here?
Any help would be greatly appreciated. If I need to provide more information, just ask. Thanks!

I guess something was wrong with mean-cli.
I reran:
npm install -g mean-cli
npm install (inside project folder)
My issue was resolved. Hope this helps someone else.

I just removed and re-installed and everything worked. Go figure. I also had to use sudo because I'm on a mac.
sudo npm install -g ember-cli#2.5

The problem is when you install config-chain it installs in your project directory node_modules but cordova add browser is looking in global modules. This is what I did, went outside the directory and ran npm install -g config-chain That resolved this module and asked for more do the same thing for all modules it complains and you should be good.

Related

Oops! I think I broke my work environment (nvm, npm, and node w/ angular). :(

It has been a long time since I programmed using my personal computer. I usually use a work computer. However, yesterday I decided to start working on a new pet project. Well, I went to set up the website in my Vagrant using VirtualBox, and now nvm, npm, and node are all messed up.
Every time I try to run npm install to set-up the node_module in my project, I get this error:
/home/vagrant/.nvm/v0.10.32/lib/node_modules/npm/lib/utils/unsupported.js:27
console.error(`a bug known to break npm. Please update to at least ${r
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
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 /home/vagrant/.nvm/v0.10.32/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object.<anonymous> (/home/vagrant/.nvm/v0.10.32/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
No matter what I try to do in npm (upgrade it, install, delete, uninstall, etc) it just throws this error.
Could somebody please help me?
The version of npm you have is not supported on Node v0.10.32. In fact Node v0.10 itself is not supported either and projects are actively dropping support it. Most dependencies will want node v4+ these days.
The version of npm you have installed will be available in the VM:
cat /home/vagrant/.nvm/v0.10.32/lib/node_modules/npm/package.json
You will need to manually extract one of the v2 or possibly even a v1 npm release over the files in /home/vagrant/.nvm/v0.10.32/lib/node_modules/npm.
Removing and setting up your nvm v0.10.32 environment again should also take npm back to a working release.
I would guess your Vagrant build does something like an npm install -g npm which would have worked at some stage but now installs the latest, incompatible version.
Use npm install -g npm#2 to stick to a v2.x release

MEAN stack, cannot find module 'request'

I'm new to mean stack world, I installed mongoDB and nodejs
node -v => v4.4.3
npm -v => 2.15.1
mongo -version => MongoDB shell version: 3.2.6
then followed MEAN installation guide to install it.
after many faults I can run gult and have a response.
now when ever I try to run any command with mean, I get following error:
module.js:327
throw err;
^
Error: Cannot find module 'request'
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> (/usr/lib/node_modules/mean-cli/lib/controllers/anonymized-data.js:8:12)
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 tried with: sudo npm install request
but still getting same issue !! can any one guide me please? thanks in advance
UPDATE
after running command given by #Alexander Mac, I got following result
it's still same status :( . and without sudo I got lots or errors #Seth :P
Alex is right about 'request' not being part of the package. That said, instead of messing out with the install manually, it might be far easier to install a previous known good version
For e.g., you can try: sudo npm i -g mean-cli#0.12.1
mean-cli package has a bug. The authors forget to include request module in package.json: look here. You can create an issue about that on their site.
To resolve the problem locally go to /usr/lib/node_modules/mean-cli and run: sudo npm i request to install missing request module.
I use nvm to manage node.
I go to /home/ougwen1235/.nvm/versions/node/v4.2.4/lib/node_modules/mean-cli and run npm install request --save.Then, the problem was solved.

Cannot find module 'readable-stream' when using npm

I installed nodejs and am trying to use npm on my Windows machine. I downloaded all the files from nodejs website. I tried to install the latest 4.4.2 version or 5.10.1 version, but I always got error Cannot find module 'readable-stream' when I tried to run commands using npm.
C:\Users\Ealon>node -v
v5.10.1
C:\Users\Ealon>npm -v
module.js:341
throw err;
^
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\Users\Ealon\AppData\Roaming\npm\node_modules\npm\node
modules\npmlog\node_modules\are-we-there-yet\index.js:2:14)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
I tried to reinstall it again and again, still could not fix this problem. And the answers in another similar question do not help because I always got error when I tried to run any command using npm. Any help is appreciated. Thanks!
Judging from the line C:\Users\Ealon\AppData\Roaming\npm\node_modules\npm\node
modules\npmlog\node_modules\are-we-there-yet\index.js:2:14 in the stack trace, I believe that you had a global installation of npm which internally had a dependency on are-we-there-yet, which I confirmed has a dependency on readable-stream.
The global installation of npm appears to have been borked, and are-we-there-yet couldn't resolve access to the readable-stream module for some reason (bad install?).
This wasn't getting fixed by re-installing node, which by default installs npm into program files (path similar to C:\Program Files\nodejs\node_modules\npm). I think the global version was getting run, but the version inside program files should be getting run, so wiping out the global installation of npm should hopefully resolve the issue.
I somehow fixed this issue by upgrading npm in Intellij IDEA.
But I still want an expnalation why that problem in my question happened. I will not mark this as the answer.
No need to uninstall node js. When I tried to update my node version, I got this issue & resolved the the same by following below step -
Go to control panel --> uninstall Programs --> select node.js
and click repair.
Had this issue on a Mac. I cloned a project multiple times to handle different branches in parallel. Only one of my cloned repos started having this same issue when I ran npm start. I deleted the repo, cloned it again and nom was running fine again in that repo. Doesn't sound like a global issue to me. No idea what went wrong.

Installing MEAN Stack: npm -v module.js: 338 throw err; Error: Cannot find module './cache/caching-client.js'

I think I have installed node.js before but never used homebrew to do it. Today I tried to do a walkthrough of an application but got stuck at the very beginning. I am fairly new to programming so I am utterly confused as to why I can't get this to work.
I have tried a lot of things but can't seem to find the answer.
These are the commands I run in order to install the MEAN stack:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
(succesful no errors)
brew install node
(succesfull no errors)
I check if node has installed properly by typing:
node -v
v0.12.4
I then check if npm is installed properly by typing:
npm -v
Here is the error message:
module.js:338
throw err;
^
Error: Cannot find module './cache/caching-client.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at /usr/local/lib/node_modules/npm/lib/npm.js:22:24
at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/npm.js:466:3)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
I have installed node in a different way other than using Homebrew and maybe that is messing things up. Please let me know your thoughts.
What I have tried to do so far is uninstall node and reinstall it using this process:
https://gist.github.com/DanHerbert/9520689
Maybe you've already fixed, but the answer might serve others.
I tried what is in the post that Mario linked to in his comment, but it didn't work. It just so happens that my npm is installed at /Users/USERNAME/.node/bin/, so I added the following line in my .bash_profile file: export PATH="$HOME/.node/bin:$PATH".
In my case it was caused by me installing node with root and later with brew (without root).
As a result brew was not able to override the old npm files upon upgrading.
Manually removing the old node installation worked for me.

nodejs Error: Cannot find module '.-audio'

Error: Cannot find module '.-audio'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (F:\Stage_ete_2018_XperMedia\2eme stage\transcription-service-master\bin\lib\job.js:6:25)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
I already did :
npm install
npm install -audio
then after executing a google-cloud Error pop up and so on, if install one module the other pop up.
npm install -audio
This does nothing, it ignores non existing options that start with a -. NPM also does not give an error, as I tried with -something_that_does_exists_for_sure as an option.
I guess you want to install the audio package: https://github.com/audiojs/audio
npm install audio
+ audio#1.2.0
added 2 packages in 1.97s
It should read that it added two packages, I think you didnt install it yet.
Also I do not understand the .- in your error:
Error:Cannot find module '.-audio'
Below is how the code example looks like in the audio package readme. See it has no dots, nor minus symbols.
const Audio = require('audio')
Audio.load('./sample.mp3').then(audio =>
audio
.trim()
.normalize()
.fade(.5)
.fade(-.5)
.save('sample-edited.wav')
)
I guess you also need to remove those from your code. Dots are only needed if you want to require files from a certain directory, not for packages installed with NPM.
You can try with this once,
Remove node_modules folder from your project directory
npm install
npm install <your_package_name> --save

Resources