Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从外部目录启动grunt_Javascript_Terminal_Gruntjs_Command Line Interface - Fatal编程技术网

Javascript 从外部目录启动grunt

Javascript 从外部目录启动grunt,javascript,terminal,gruntjs,command-line-interface,Javascript,Terminal,Gruntjs,Command Line Interface,是否可以通过终端启动grunt任务而不在我的工作文件夹中 我这样问是因为我正在尝试自动执行grunt命令,但是我的终端命令将从我的个人文件夹中执行 我尝试了这些,但没有成功: weyland$ /Applications/MAMP/htdocs/test/app/js/grunt No such file or directory cd /Applications/MAMP/htdocs/test/app/js/ & grunt Fatal error: Unable to find

是否可以通过终端启动grunt任务而不在我的工作文件夹中

我这样问是因为我正在尝试自动执行grunt命令,但是我的终端命令将从我的个人文件夹中执行

我尝试了这些,但没有成功:

weyland$ /Applications/MAMP/htdocs/test/app/js/grunt
No such file or directory


cd /Applications/MAMP/htdocs/test/app/js/ & grunt
Fatal error: Unable to find local grunt.

您可以设置两个参数
--base
--gruntfile

因此,您可以调用watch task,例如:

grunt --base your_path --gruntfile your_app_path/GruntFile.js watch 
如果您呼叫grunt--help:

--base
指定备用的基本路径。默认情况下,所有文件路径都是相对于GrunFile的。(grunt.file.setBase)*

--gruntfile
指定备用gruntfile。默认情况下,grunt在当前或父目录中查找最近的Gruntfile.js或Gruntfile.coffee文件

希望能有帮助

问候