我通过grunt-sftp-deploy --verbose
收到此错误我刚开始使用grunt,只需要将通过sass生成的watch css上传到服务器上的某个点。
Registering "grunt-sftp-deploy" local Npm module tasks.
Reading
***************\public\grunt\node_modules\grunt-sftp-deploy\package.json...OK
Parsing
***************\grunt\node_modules\grunt-sftp-deploy\package.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"
}
}
答案 0 :(得分:0)
最后只有.ftppass
没有.json。将它放在与Gruntfile.js相同的目录中就可以了