php - 从 php 脚本中执行 grunt 任务

标签 php gruntjs

我想用 exec('grunt') 在 php 脚本中执行一个 grunt 任务,但我总是得到 127。任何其他 bash 命令都可以。

我什至做了一个 grunt.sh

#!/bin/bash
grunt

并尝试通过 exec('grunt.sh') 执行,但也得到 127 返回。

对此有什么想法吗?

最佳答案

它与 node 和 grunt 的绝对路径一起工作。 exec('/usr/local/bin/node/usr/local/bin/grunt')

(在 OS X 10.10.4 上——路径当然在不同的操作系统上不同)

关于php - 从 php 脚本中执行 grunt 任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29732879/

相关文章:

javascript - 如何从使用ajax更新的json文件中提取值并将其用作php变量

node.js - -bash : grunt: command not found - mac OSx

node.js - 找不到有效的 Gruntfile

node.js - sass 不编译我的媒体指令

php - 如何在php中使文件下载仅将文件路径保存在数据库中

php - php中的循环算法等于主场分布

php - 防止重复+相同电商订单的页面设计

php - 如何在 Joomla 3.0 或 PHP 中将多维数组保存到数据库

gruntjs - stylelint-selector-bem-pattern BEM linter 不起作用

javascript - Ember.js 如何引用 Grunt.js 预编译的 Handlebars 模板?