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

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

问题描述

我在安装 Node 和 Coffeescript 时遇到了一些困难.我已经使用自制软件安装了节点,然后我已经成功安装了 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天全站免登陆