简体   繁体   中英

Can't install node.js with coffeescript on Ubuntu 12.04

Tried to install node.js with coffeescript like this :

sudo sudo apt-get install nodejs npm
sudo npm install -g coffee-script

But:

coffee -v

Returns me:

Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
    at Function.Object.defineProperty.get (module.js:388:11)
    at Object.<anonymous> (/home/lapsa/bin/coffee@1.3.0:4:21)
    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)
    at startup (node.js:119:16)
    at node.js:903:3

I'm completely lost at the moment. Any help?


Tried this approach w/o success.

$ npm -v
1.2.15

$ node -v
v0.11.0-pre

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.2 LTS
Release:        12.04
Codename:       precise

This solution worked for me (tested on both Ubuntu 12.04 and 13.04):

sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
sudo npm install -g coffee-script

Source: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

Note that it does not use the default Ubuntu package npm . Instead npm is packaged with in Chris Lea's nodejs package.

If you already have npm installed, you might want to remove it first before applying the workaround above. Note that there is also a naming conflict with a package named node but which has nothing to do with nodejs. If you installed that package by accident, you might also want to remove it.

I'm wondering if your problem is related to trying to install npm using

sudo apt-get install nodejs npm

If you take a look at the instructions for installing nodejs via package manager it states that

As of Node.js v0.10.0, the nodejs package from Chris Lea's repo includes both npm and nodejs-dev.

I wonder if a rogue installed version of an npm package is causing you a problem. I ran into this the other day but for me, npm just wouldn't install.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM