I'm trying to get a virtual server running using Vagrant and VirtualBox. For the VirtualBox I'm using scotch/box which got all the basic stuff for running a ubuntu server with some components (apache, mysql, php etc.) more on scotchbox can be found here.

Now I got the server up and running (running a Yii2 application) but as soon as the application starts I get an Yii error message sh: 1: sass: not found and because of that a SASS file couldn't be converted to CSS. So I went back to my server to check if sass was installed, it wasn't so I ran the command gem install sass and after that sass was installed. gem list sass -i returned true.

But still the problem stayed, sass couldn't be found. I went back to my console and of course apache is ran by user www-data and I logged in to ssh with the vagrant user. And this is were it gets a bit vague for me. In the environments variables of the apache service I added the paths to both ruby and the gems. The but still the www-data user cannot find the sass command or the gem command or even the ruby command.

I also tried to change the owner of the apache service from www-data to the vagrant user but that did kinda help but thats not the solution I want to accept. I want a solution that the apache service stays owned by the www-data user and not a root user like vagrant.

If more data needs to be added please let me know.


How are you starting your Yii application? It sounds like you are launching it via the command line. Whichever user you're using to launch that doesn't see the sass application in its paths. You have a few choices.

  • Update the users PATH to include /usr/local/bin (or wherever sass lives, which you can determine by running which sass
  • Create a symlink from /usr/local/bin/sass to a directory your user does search successfully (something like /bin might work)

Could you provide a paste of the command you are running when you hit this error? If you run which sass after the Yii failure, do you see results for the location of the script? Can you confirm you're trying to run this by hand, or if you're hitting a page through apache (at which point, the www-data user would come into play).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.