在Mac OSX中难以安装Node.js和CoffeeScript [英] Difficulty installing Node.js and CoffeeScript in Mac OSX

查看:232
本文介绍了在Mac OSX中难以安装Node.js和CoffeeScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在安装Node和Coffeescript时遇到一些困难。我已经安装节点使用homebrew,然后我已经成功安装NPM。我尝试从NPM安装Coffeescript,似乎工作,但是我不能运行咖啡

I'm having some difficulty installing Node and Coffeescript. I have installed node using homebrew and then I have successfully installed NPM. I have tried to install Coffeescript from NPM and it appears to have worked but then I cannot run coffee

localserver:Documents x$ sudo npm -g install coffee-script
Password:
npm http GET https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/coffee-script
/usr/local/share/npm/bin/coffee -> /usr/local/share/npm/lib/node_modules/coffee-script/bin/coffee
/usr/local/share/npm/bin/cake -> /usr/local/share/npm/lib/node_modules/coffee-script/bin/cake
coffee-script@1.4.0 /usr/local/share/npm/lib/node_modules/coffee-script
localserver:Documents x$ coffee
-bash: coffee: command not found
localserver:Documents x$ 

有没有一些路径环境变量,我需要为此设置?即使我导航到 / usr / local / share / npm / lib / node_modules / coffee-script / bin / coffee ,我无法从这里运行它。

Is there some path environment variable that I need to set for this? Even if I navigate to /usr/local/share/npm/lib/node_modules/coffee-script/bin/coffee I cannot run it from here.

推荐答案

看起来npm不会将coffee的目录添加到PATH。您可以用以下方法修复它:

Looks like npm doesn't add coffee's directory to the PATH. You can fix it with the following:

export PATH=/usr/local/share/npm/lib/node_modules/coffee-script/bin/:$PATH

我相信肯定有更好的方法。但是我不知道OSX足够回答。

I'm quite sure there must be a better way though. But I don't know enough OSX to answer.

如果你希望这个更改是永久的,添加一行到你的〜/ .profile 文件。

If you want this change to be permanent, add the line to your ~/.profile file.

这篇关于在Mac OSX中难以安装Node.js和CoffeeScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆