首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >grunt部署authKey ftppass

grunt部署authKey ftppass
EN

Stack Overflow用户
提问于 2016-01-14 02:34:28
回答 1查看 641关注 0票数 0

我通过grunt-sftp-deploy --verbose收到此错误

我刚刚开始抱怨,只需要上传通过sass生成的手表css到服务器上的某个点。

代码语言:javascript
复制
    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看起来就像这样

代码语言:javascript
复制
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

代码语言:javascript
复制
{
  "key1": {
    "username": "username",
    "password": "pass"
  }
}
EN

回答 1

Stack Overflow用户

发布于 2016-08-05 17:30:07

最终,它只是没有.json的.ftppass。将其放在与Gruntfile.js相同的目录中即可完成此操作

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34774432

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档