简体   繁体   English

从PHP运行SASS时出现错误127

[英]Error 127 when running SASS from PHP

I'm trying to use SASS from PHP but I always get a 127 error. 我正在尝试从PHP使用SASS,但总是收到127错误。

Here is what I'm doing: 这是我在做什么:

$command = 'sass pathtomyfile.scss:pathtomyfile.css';

system($command, $return); 

echo $return; // give me: 127

If I run the exact same command in the terminal, everything work fine. 如果我在终端中运行完全相同的命令,则一切正常。 Note that I'm trying to do it on Mac OS X. 请注意,我正在Mac OS X上尝试这样做。

Edit: I believe this is a permission issue but I have no idea of how to solve this. 编辑:我相信这是一个权限问题,但我不知道如何解决此问题。

Edit 2: I'm using rvm 编辑2:我正在使用rvm

127 error is command not found make sure the PATH is set correctly to a place where sass command was installed or full path to the command, you can find the full path to sass by running in your shell which sass . 127错误command not found确保将PATH正确设置为sass命令的安装位置或该命令的完整路径,您可以通过在shell which sass运行来找到sass的完整路径。

As you use RVM you can make sure proper environment is used with wrappers: 使用RVM时,可以确保包装器使用正确的环境:

$ rvm use 1.9.3 --install
$ gem install sass
$ rvm wrapper 1.9.3 php sass
$ which php_sass
/home/user/.rvm/bin/php_sass

and use the returned path to run sass . 并使用返回的路径运行sass

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM