Nodejs and npm error. modules missing - node.js

module.js:340
throw err;
^
Error: Cannot find module 'vinyl'
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/morpheyesh/debugall/web-starter-kit/node_modules/gulp/node_modules/gulp-util/lib/File.js:1:80)
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 major issues with node.js. I try to run any nodejs application or gulp, i get this error, I try to install every module , I keep getting the same error and it requires a new module. Is there anyway where I can install all the modules?
Plus, I have install nodejs through npm? how to install system wide? Gulp is been installed system wide(global). What is causing this error?
nodejs -v gives v0.10.30
`npm -v gives 1.4.21
gulp 3.8.7
I am working with the google web starter kit. I installed nodejs using apt-get, then install sass, then installed gulp, then npm. Is there a way where I can remove all these and install all of it system wide?

Try updating your global gulp installation:
sudo npm install --global gulp#latest

It sounds like everything is (was?) FUBAR for a while there. If you have not yet solved these problems, here's what I would recommend.
First, the official (Debian/Ubuntu) packages are a bit behind latest node. I would recommend uninstalling the packages nodejs and nodejs-legacy and following the instructions here to get the latest versions (packaged and published by nodesource): https://github.com/nodesource/distributions#usage-instructions
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
Now you will have a recent node (0.10.35) but an out-of-date npm. Upgrade your npm:
npm install -g npm#latest
Things should now work for you; you should be able to run npm install in your project directory and all dependencies will be installed correctly.
One thing to be wary of is that you should never run npm update or npm update -g. This does not update the current (or all global) packages, as one might think.

Try this for install all plugins required by gulp :
npm install gulp-jshint gulp-sass gulp-concat gulp-uglify gulp-rename --save-dev
Source : http://travismaynard.com/writing/getting-started-with-gulp

For me uninstalling gulp and then reinstalling it worked fine. This is with node v5.0.0
sudo npm uninstall -g gulp
npm install -g gulp

Related

Cannot find module 'findup-sync' on running grunt

I am working in a project previously built. This project was built using Node and Grunt.
I have a Gruntfile.js in the root folder of the project.
I installed grunt both locally and global, using
npm i grunt
npm i -g grunt
After, I installed grunt-cli both locally and global, using
npm i grunt-cli
npm i -g grunt-cli
And when I try to run any grunt command (develop, init, etc), I get the error
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'findup-sync'
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:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/usr/lib/nodejs/grunt-cli/bin/grunt:8:14)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787: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)
I searched in many forums and here too, but I haven't found an answer.
Can anybody help me?
UPDATE
After lose more than 24 hours working on this error, I fixed it with the following steps:
Install node-grunt-cli in Ubuntu via apt, like CPBL says in his comment
apt install node-grunt-cli
On OSX this wasn't necessary.
Following the steps I found on this blog. However, I also needed to run the command
grunt develop
as a sudo, even though changing the permissions of many folders.
Thanks to Pablo Lopes for putting me on the right track (see his question which includes the answer). I resolved my issue by:
Installing node-grunt-cli via apt:
sudo apt install node-grunt-cli
Running grunt with sudo:
sudo grunt
This isn't an ideal fix because it requires using sudo when running grunt - which shouldn't be necessary.
For me, installing via apt was the cause of the issue. Installing via npm npm install grunt -g corrected the problem. Given an existing global grunt install from apt, you might need to add --force to overwrite.

angular cli not working on windows 10

I have just reinstall node.js, npm and angular-cli but this last one does not work on my PC running on Windows 10. The version of node.js is 8.1.2, the version of npm is 5.0.3. I installed angular-cli with the command line npm install -g #angular/cli. Now when I try any command line beginning with ng I have the error:
module.js:487
throw err;
^
Error: Cannot find module '#ngtools/json-schema'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Raphaël\AppData\Roaming\npm\node_modules\#angular\cli\models\config\config.js:6:23)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
Any idea what is wrong?
Shot in the dark, but I heard of -g installs interfering with local angular cli. However, this appears to just be a missing module from the download, maybe just a package lost. Try to uninstall and re-install again
I'm also on Windows 10. Node 8.1.4 and npm 5.2.0
What worked for me was following the steps from an issue thread I found on github: https://github.com/angular/angular-cli/issues/4425
. The link describes the following steps:
Uninstall angular cli
npm uninstall #angular/cli -g
Install rxJS
npm install rxjs -g
Cleared cache
npm cache clean
Manually deleted content in
%AppData%\npm\node_modules
Installed angular cli npm install
#angular/cli -g
Try downgrading node to v7 and npm to v4 then run:
rm -rf node_modules dist
npm cache clear --force
npm install
There are also some threads mentioning the removal of package.lock which is a new part of npm#5. Furhtermore it is worth checking you typescript version ensuring it is > 2.2.0.

Ionic wont start after npm install ionic

Im on osx. I had a development with node, npm and ionic. Everything worked.
I accidentally run this command:
npm install -g ionic
After that Ionic is not working anymore. if I try to create a project or start an existing one I got this error:
Caught exception:
Error: Cannot find module 'inherits'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/glob/glob.js:42:14)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
Mind letting us know? https://github.com/driftyco/ionic-cli/issues
npm -v gives:
3.10.8
node -v gives:
v6.4.0
ionic -v
gives the same error message as above.
Im not sure if I installed node/npm with brew or what else. Any ideas?
in my case , uninstalling and reinstalling the ionic worked .
1.npm uninstall -g ionic cordova
2.npm install -g ionic cordova
3.npm update minimatch
4.try reinstalling ionic using ionic#latest
This is because the module 'inherits' is missing which may be a problem with npm.
I'll simply suggest uninstalling and installing again as you may have downloaded corrupt/incomplete files.
On MacOS/Unix:
brew uninstall npm
sudo rm -rf /usr/lib/node_modules/
brew install npm
Then retry installing ionic
npm uninstall -g ionic
npm install -g ionic
Try again by adding “read and write” permission to your project root folder
Like
Ionic is my project root folder and under the ionic folder i have a app named ionicapp

npm cannot find module

I've been all over Google and StackOverflow, viewing the various threads related to similar issues, but so far nothing has worked. My problem is that npm seems to be installing improperly...or something, I honestly have no idea: Node and npm are a dependency I use to support the Sage Wordpress theme buildout I'm working on on a different machine.
So the issue is that after uninstalling Node (to be safe), and reinstalling, Node seems to be working fine. node -v returns v5.1.0. Great. npm should be installed with it, but when I run npm -v I get the following lovely bit of error:
$ npm
module.js:340
throw err;
^
Error: Cannot find module 'readable-stream'
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> (/Users/Daniel/.nvm/versions/node/v5.1.0/lib/node_modules/npm/node_modules/ npmlog/node_modules/are-we-there-yet/index.js:2:14)
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)
Running any npm command (even just npm) gives me this error, so as suggested in other solutions, I cannot simply run npm install readable-stream. I have also gone through various solutions (removing the node_modules folder, installing via brew, installing via brew without npm, and several others), but none seem to be working.
Any thoughts would be much appreciated.
I was just wrestling with this problem for half an hour (on Mac) after a failed npm update. I'm using Homebrew and I found I had to do the following:
sudo chown -Rv $USER /usr/local/lib/node_modules/ with my username
Then I reinstalled node via Homebrew:
brew uninstall node
brew install node
By this point npm was working again and I went ahead with a successful npm i -g npm
If you're having problems with NPM and you want to reinstall on UNIX I found this to be the easiest solution:
curl -L https://npmjs.org/install.sh | sudo sh
This will reinstall NPM and get it setup to use the latest NPM Version. This will almost always resolve any issues regarding NPM.
When the process is complete you should receive a message saying It worked.
You can run with command line as below:
npm install // you need remove node_modules folder, run npm install

node npm install -g cannot find module config-chain

I configured the node plugins on jenkins to install grunt and bower globally.
When i use it on a project npm install is executed:
npm install -g bower#~1.2.8 grunt-cli#~0.1.11
Unfortunally it breaks immediately returning the following error:
module.js:333
throw err;
^
Error: Cannot find module 'config-chain'
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> (/Users/Shared/Jenkins/Home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node_0.11.10/lib/node_modules/npm/node_modules/npmconf/npmconf.js:2:10)
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 Module.require (module.js:357:17)
I dont think config-chain is an extra plugin necessary to be installed for it to be there.
Any ideas how to fix this?
Edit.: Fixed it thanks to the accepted answer:
npm auto-install isnt supported for mac at this time. I had to download the package manually.
config-chain is npm dependency, so chances are that your npm installation is broken.
Try to reinstall it, or use one of npm forks if npm itself isn't installable on your system for some reason.
Follow this suggest, i resolve it.
"Who ever faces this problem, please do a clean install of ionic"
npm install -g ionic
If it got installed and you're still facing issues, easily install each missing module you face, globally example
npm install -g config-chain
This will re-install all missing modules, as this might have happened when you upgraded your node
https://forum.ionicframework.com/t/cannot-find-module-config-chain/37130/7"
I encountered a different problem.
It appears as though the Jenkins NodeJS plugin was incorrectly downloading and unpacking packages from the Node.js website. When I went to go look at the unzipped folder and did an npm list, there were several packages missing.
I fixed this by telling Jenkins to download a zip file directly and unpack it.
It was the same issue.
I had moved NPM prefix to 'C:\ProgramData\npm\' (you can see your prefix in 'npm config list' command).
After that I should install global packages only under the administrator credentials.

Resources