【发布时间】:2023-03-08 01:31:01
【问题描述】:
我正在尝试使用 Grunt 将文件从本地发行版构建到生产环境。我已经通过 bash 文件进行了测试,并且可以正常工作。我只是无法使用 grunt 运行它。
在我的 grunt 文件中:
/*global module:false*/
module.exports = function(grunt) {
grunt.initConfig( {
...
exec: {
ftpupload: {
command: 'ftp.sh'
}
}
} );
grunt.loadNpmTasks('grunt-exec');
grunt.registerTask('deploy', ['ftpupload']);
};
我在命令行尝试grunt deploy,得到以下错误:
Warning: Task "ftpupload" not found. Use --force to continue.
我在命令行尝试grunt exec,得到以下错误:
Running "exec:ftpupload" (exec) task
>> /bin/sh: ftp.sh: command not found
>> Exited with code: 127.
>> Error executing child process: Error: Process exited with code 127.
Warning: Task "exec:ftpupload" failed. Use --force to continue.
ftp.sh 文件与Gruntfile.js 位于同一目录中。
如何配置它以便我可以运行 grunt deploy 并运行 bash 脚本?
【问题讨论】:
标签: node.js bash ftp gruntjs grunt-exec