Search code examples
phpcakephpcakephp-bake

"cake bake" returns "env: node: No such file or directory"


I'm experienced with Ruby but new to PHP, getting CakePHP set up on my machine and I would love some help.

I've downloaded a version of Cake and placed it at /Users/zack/Sites/cake

From that directory, I've done cd cake/console and tried running cake bake but get the error env: node: No such file or directory

I've tried running chmod 755 cake to change permissions but that didn't work.

Any suggestions on how to get this working properly?


Solution

  • This is a pretty strange issue :))

    1) You've installed coffeescript and it comes with a cake command. It's in /usr/bin so if there's no local cake available then it will run;

    2) CakePHP's cake command only works if you are in an app folder (so cd myCakeApp first);

    3) coffeescript's cake is a NodeJS script. It tries running node something. The error you are getting is telling you it could not find NodeJS.

    Try prepending ./, so ./cake bake. That will make sure it only tries to run the cake command inside the current path/folder.