Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: cannot find module 'mime'

I am trying to install cartodb on ubuntu 12.04. I have done all the steps mentioned on https://github.com/danseely/cartodb-install/blob/master/DEV-INSTALLATION.md and I am stuck at the Install Windshaft-cartodb Step. The following steps worked fine:

cd ~
git clone git://github.com/CartoDB/Windshaft-cartodb.git
cd Windshaft-cartodb
git checkout master
npm install
cp config/environments/development.js.example   config/environments/development.js

Whenever I hit the command node app.js development, it gives me following error:

module.js:340
throw err;
      ^
Error: Cannot find module 'mime'
 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/user/Windshaft- cartodb/node_modules/windshaft/node_modules/grainstore/node_modules/millstone/lib/millstone.js:6:12)
 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)
 at require (module.js:380:17)

I installed mapnik using

sudo add-apt-repository ppa:mapnik/v2.2.0
sudo apt-get update
sudo apt-get install libmapnik libmapnik-dev mapnik-utils python-mapnik
like image 367
harinish Avatar asked Dec 18 '22 23:12

harinish


1 Answers

@harinish This problem occur due to many reasons, one of the peculiar reason is, if you have different versions of the Node JS installed on your system. Check this Github discussion

But the best way to resolve this issue of missing module, install it using the NPM as follows:

npm install mime

Remember the command install into the current directory from where you are executing this command. If you want to install globally use it with -g switch as follows:

npm install mime -g

Then run the program, it will be resolved.

like image 57
user3278897 Avatar answered Jan 02 '23 10:01

user3278897