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

查看:31
本文介绍了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 中查找到 coffee 的符号链接.

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

2) 由于 (1),我覆盖了 $PATH 以包含 coffee 的实际位置,即 /usr/local/lib/node_modules/coffee-script/bin,但由于某种原因,$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) 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?

推荐答案

在终端中,输入 which node,然后在 /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

如果您查看 coffee 脚本的源代码,您可能会发现第一行类似于:

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,但它无法执行它,因为node 二进制文件不在 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 的默认搜索路径.第一个(也是最简单的)是始终使用内置的 <从命令行打开它code>subl 命令.如果您是 OS X 高级用户并且不介意弄乱重要的系统设置,请查看 我的帖子在 unix.SE 上了解如何更改您所看到的默认 /usr/bin:/bin:/usr/sbin:/sbin 路径.预先警告,如果你做的事情不正确,你可能会破坏你的系统.但是,如果您运行的是 Mountain Lion (10.8.X) 并且完全按照说明进行操作,那么一切都应该没问题.(我还没有升级到 Mavericks,所以不能保证它是否适用于那个版本.)

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天全站免登陆