I am trying to use express
in an ubuntu 13.10 distribution. I am using node version 0.10.29
and npm 1.4.14
When I use express
this is my output:
module.js:340
throw err;
^
Error: Cannot find module 'mkdirp'
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> (/usr/bin/express:10: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)
at Function.Module.runMain (module.js:497:10)
Additionally, I have to use sudo npm
as npm
doesn't work (i'm not sure if that's part of the issue - but I suspect path issues, not really sure). I have googled but haven't been able to fix the issues.
Edit: I think I messed up my path. I am unable to reinstall npm. Here is output from $PATH
bash: /home/qtrain/npm/bin:/usr/bin/yo:/home/qtrain/.node/bin:/home/qtrain/Enthought/Canopy_64bit/User/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/qtrain/.rvm/bin:/home/qtrain/.rvm/bin:/home/qtrain/.rvm/bin:
The mkdirp
error seems to originate from using the chris-lea repo for node.js
as Michael answered.
To fix: eliminate the PPA and node itself, then reinstall as below.
1.) sudo apt-get install ppa-purge
- if you don't already have it
2.) sudo ppa-purge ppa:chris-lea/node.js
3.) sudo apt-get remove nodejs
4.) sudo apt-get remove npm
5.) sudo apt-get autoremove
6.) sudo apt-get install nodejs
7.) sudo apt-get install npm
8.) sudo apt-get install node-express
I ran into a similar problem while using npm and express. My solution was to uninstall node from my entire system using sudo apt-get remove nodejs
Then I reinstalled node from source following directions here http://chimera.labs.oreilly.com/books/1234000001808/ch01.html#chap5_id35941617
Then I had to install npm separately using sudo apt-get install npm
but it still didn't work.
It was then that I realized that ppa repos I had installed from chris lea were not configured for 13.10
https://launchpad.net/~chris-lea/+archive/ubuntu/node.js-legacy
Removed them and reinstalled npm using sudo apt-get install npm
and installed express with sudo apt-get install node-express
I was then able to use npm and express
Hope this helps..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.