无法在Ubuntu 12.04上使用coffeescript安装node.js.

时间:2013-03-21 12:34:47

标签: node.js ubuntu coffeescript

尝试使用coffeescript安装node.js,例如this

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

但是:

coffee -v

返回我:

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

此刻我完全迷失了。有什么帮助吗?


尝试this approach没有成功。

$ 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

2 个答案:

答案 0 :(得分:3)

此解决方案适用于我(在Ubuntu 12.04和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

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

请注意,它不使用默认的Ubuntu包npm。而是将npm打包在Chris Lea的nodejs包中。

如果您已安装npm,则可能需要在应用上述解决方法之前先将其删除。请注意,与名为node的程序包之间也存在命名冲突,但与nodejs无关。如果您意外安装了该软件包,则可能还需要将其删除。

答案 1 :(得分:2)

我想知道您的问题是否与尝试使用

安装npm有关
sudo apt-get install nodejs npm

如果您查看installing nodejs via package manager的说明,请说明

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

我想知道一个流氓安装版本的npm软件包是否会导致问题。我前几天碰到了这个,但对我来说,npm就是不会安装。