Sublime Text CoffeeScript构建系统:`env:node:没有这样的文件或目录 [英] Sublime Text CoffeeScript build system: `env: node: No such file or directory`

查看:167
本文介绍了Sublime Text CoffeeScript构建系统:`env:node:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Sublime Text 3中设置一个CoffeeScript构建系统,但我一直收到以下错误:

I'm trying to set up a CoffeeScript build system in Sublime Text 3, but I keep getting the following error:

env: node: No such file or directory
[Finished in 0.0s with exit code 127]
[cmd: ['coffee', '-o','/Users/jcourtdemone/Sites/autotempest.com/new_design_sandbox/static/script', '-cw', '/Users/jcourtdemone/Sites/autotempest.com/new_design_sandbox/static/coffee']]
[dir: /Users/jcourtdemone/Sites/autotempest.com/new_design_sandbox/static/coffee]
[path: /usr/bin:/bin:/usr/sbin:/sbin]

我的构建系统看起来像这样:

My build system looks like this:

{
    "name": "Coffee - AT",
    "cmd": ["coffee","-o","${project_path:${folder}}/static/script","-cw","${project_path:${folder}}/static/coffee"],
    "selector": "source.coffee",
    "path":"/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/lib/node_modules/coffee-script/bin"
}

两个奇怪的事情。

1)它表示它在 / usr / bin 中找到一个符号链接咖啡存在。

1) It says it's looking in /usr/bin where a symlink to coffee exists.

2)由于(1),我反而 $ PATH 以包括咖啡的实际位置,它是 / usr / local / lib / node_modules / coffee-script / code>,但由于某些原因, $ PATH 没有被正确覆盖,它坚持使用默认 $ PATH

2) Because of (1), I overrode $PATH to include the actual location of coffee which is /usr/local/lib/node_modules/coffee-script/bin, but for some reason, $PATH isn't being overridden properly, it's sticking with the default $PATH.

注意事项:

我已验证所有路径都正确,

i) I've verified that all paths are correct and pass normally through a regular terminal command.

ii)在构建中使用shell:true 变量进行测试系统。

ii) Tried with a "shell": true variable in the build system.

iii)我有另一个Compass的构建系统,工作正常。

iii) I have another build system for Compass like this that works fine.

类似的问题或问题?任何想法?

Anyone run into similar problems or issues? Any ideas?

推荐答案

在Terminal中,键入哪个节点指向 / usr / bin 中该位置的符号链接。例如,如果 node 位于 / usr / local / bin ,请创建如下所示的符号链接:

In Terminal, type which node, then create a symlink to that location in /usr/bin. For example, if node lives in /usr/local/bin, create the symlink like so:

sudo ln -s /usr/local/bin/node /usr/bin/node

如果你看一下你的咖啡脚本的源代码,你可能会发现第一行是符合以下内容的:

If you look at the source of your coffee script, you'll probably find that the first line is something along the lines of:

#!/usr/bin/env node

Sublime中的退出代码127意味着 env 命令失败 - 构建系统找到 coffee ,但它不能执行它,因为节点二进制不在Sublime的默认搜索路径。

Exit code 127 in Sublime means that an env command has failed - so in your case, the build system is finding coffee, but it can't execute it because the node binary isn't in Sublime's default search path.

有两种方法来重新定义Sublime的默认搜索路径。第一个(也是最简单的)是始终使用内置的 从命令行打开它subl 命令。如果您是OS X用户,并且不介意重要的系统设置,请查看我的帖子在unix.SE上如何改变你看到的默认 / usr / bin:/ bin:/ usr / sbin:/ sbin 路径。要预先警告,如果你不正确地做事情,你可能会破坏你的系统。然而,如果你正在运行Mountain Lion(10.8.X),并且你完全按照说明,一切都应该很好。 (我还没有升级到小牛,所以没有保证是否它将工作与该版本。)

There are two ways to redefine the default search path for Sublime. The first (and easiest) is to always open it from the command line using the built-in subl command. If you're an OS X power user and don't mind messing with important system settings, check out my post on unix.SE on how to alter the default /usr/bin:/bin:/usr/sbin:/sbin path that you're seeing. Be forewarned that if you don't do things correctly, you may break your system. However, if you're running Mountain Lion (10.8.X) and you follow the instructions exactly, everything should be fine. (I haven't upgraded to Mavericks, so no guarantees on whether it'll work with that version.)

这篇关于Sublime Text CoffeeScript构建系统:`env:node:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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