部署authKey ftppass
我通过grunt-sftp-deploy --verbose收到此错误
我刚刚开始使用grunt,只需要将通过sass生成的watch css上传到服务器上的某个点即可。
Registering "grunt-sftp-deploy" local Npm module tasks.
Reading
***************publicgruntnode_modulesgrunt-sftp-deploypackage.json...OK
Parsing
***************gruntnode_modulesgrunt-sftp-deploypackage.json...OK
Loading "sftp-deploy.js" tasks...OK
+ sftp-deploy
Loading "Gruntfile.js" tasks...OK
+ default
Running tasks: sftp-deploy
Running "sftp-deploy" task
Running "sftp-deploy:build" (sftp-deploy) task
Verifying property sftp-deploy.build exists in config...OK
Files: ../css -> /server/path
**Warning: .ftppass seems to be missing or incomplete Used --force, continuing.**
>> Concurrency : 4
Connection :: connect
**>> Error: Timed out while waiting for handshake
Fatal error: Connection :: error**
那么gruntfile.js看起来就是这样
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
'sftp-deploy': {
build: {
auth: {
host: 'XXX.XXX.XXX.XXX',
port: 22,
authKey: 'key1'
},
cache: 'sftpCache.json',
src: '../css',
dest: '/server/path',
exclusions: [
],
serverSep: '/',
concurrency: 4,
progress: true
}
},
sass: {
dist: {
options: {
style: 'expanded',
noCache: true
},
files: [{
expand: true,
cwd: '../sass/pages',
src: ["**/*.scss"],
dest: '../css',
ext: ".css"
}]
}
},
watch: {
options: {
nospawn: true,
nocache: true,
livereload: true
},
sass: {
files: ['../sass/**/*.scss'],
tasks: ['sass']
},
sftp: {
files: ['../css/**/*.css'],
tasks: ['sftp-deploy']
}
}
});
grunt.loadNpmTasks('grunt-sftp-deploy');
grunt.registerTask('default', ['watch']);
};
Sass是正确的,但我找不到为什么不上传文件到服务器。
那么我的问题是:
我错过了什么? 哪个应该是.ftppass.json的路径? 现在和gruntfile.js是一样的地方,但我也遇到了问题,我怀疑这是不对的。 但是在sftp-deploy gruntfile.js设置中没有空间来设置.ftppass.json。 我如何正确设置路径?
.ftppass.json
{
"key1": {
"username": "username",
"password": "pass"
}
}
它最终只是.ftppass
没有.ftppass
。 把它放在与你的Gruntfile.js相同的目录下就可以了
下一篇: Sails, grunt