Run Grunt commands from PHP on Windows
To run grunt commands from PHP on my Mac, I can use putenv
to tell PHP where NodeJS lives and the global PATH so that I can run grunt commands like:
putenv('PATH=' . getenv('PATH') . ':/usr/local/bin');
exec('grunt watch');
But on Windows 7, NodeJS is in a different location ...
First I tried:
putenv('PATH=' . getenv('PATH') . ':C:\Program Files (x86)\nodejs');
This is where NodeJS itself lives, but it doesn't work ...
and then tried:
putenv('PATH=' . getenv('PATH') . ':C:\Users\cameron.drysdale\AppData\Roaming\npm');
Where does npm live (I don't know why on Windows it lives in diff location for exe). But then again it doesn't work, and I get an error that grunts - unknown command. grunt-cli is definitely installed globally!
Any ideas on what the path should be for Windows?
+3
source to share