Created
January 14, 2019 22:00
-
-
Save johnbeech/c1ee615e0118e591d6945e93c45d6277 to your computer and use it in GitHub Desktop.
ftp-deploy 501 Error: Invalid number of arguments - remoteRoot: '/' not working (works ok if I changed roots to /site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ftpDeploy = require('ftp-deploy') | |
const deployer = new ftpDeploy() | |
const fs = require('fs') | |
const path = require('path') | |
const passwords = JSON.parse(fs.readFileSync(path.join(__dirname, '.ftppass'))) | |
const mode = process.argv[2] || false | |
const defaultConfig = { | |
user: passwords['mkv25-stage'].username, | |
password: passwords['mkv25-stage'].password, // optional, prompted if none given | |
host: 'ftp.mkv25.net', | |
port: 21, | |
localRoot: path.join(__dirname, '../'), | |
remoteRoot: '/', | |
// include: ['*', '**/*'], // this would upload everything except dot files | |
include: [], // ['*.php', 'dist/*'], | |
exclude: ['.ftp*', '.git*', '.hta*', 'deploy', '*.fdproj', 'tasklist.md', 'readme.md', '.sublime'], // ['dist/**/*.map'], // e.g. exclude sourcemaps - ** exclude: [] if nothing to exclude ** | |
deleteRemote: false, // delete existing files at destination before uploading | |
forcePasv: true // Passive mode is forced (EPSV command is not sent) | |
} | |
const variations = { | |
'stage-images': { | |
include: ['site/images/**/*'] | |
}, | |
'stage-code': {}, | |
'stage-all': { | |
include: ['site/**/*'] | |
}, | |
'stage-php': {}, | |
'stage-php-lib': {}, | |
'stage-scripts': {}, | |
'stage-stylesheets': {}, | |
'stage-templates': {}, | |
'stage-content': {}, | |
'stage-articles': {}, | |
'stage-projects': {}, | |
'live-release': {} | |
} | |
deployer.on('uploading', function(data) { | |
console.log(data) | |
console.log('[Deploy] Uploading:', data.filename, ',', data.transferredFileCount, 'of', data.totalFilesCount, 'complete') | |
}) | |
deployer.on('uploaded', function(data) { | |
console.log(data) | |
console.log('[Deploy] Uploaded:', data.filename, ',', data.transferredFileCount, 'of', data.totalFilesCount, 'complete') | |
}) | |
deployer.on('log', function(data) { | |
console.log('[Deploy]', data) | |
}) | |
async function deploy(mode) { | |
const variation = variations[mode] || false | |
if (variation) { | |
const ftpConfig = Object.assign({}, defaultConfig, variation) | |
try { | |
console.log('[Deploy]', mode, ':', variation) | |
const result = await deployer.deploy(ftpConfig) | |
console.log('[Deploy] Finished:', result) | |
} | |
catch (ex) { | |
console.log('[Deploy] Error:', ex) | |
} | |
} else { | |
console.log(`[Deploy] No variation found for mode (${mode})`) | |
} | |
} | |
deploy(mode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>node deploy stage-all | |
[Deploy] stage-all : { include: [ 'site/**/*' ] } | |
[Deploy] Connected to: ftp.mkv25.net | |
[Deploy] Connected: Server message: 192.252.146.30 FTP server ready | |
[Deploy] Error: { Error: Invalid number of arguments | |
at makeError (C:\Users\User\Work\Local\mkv25-responsive-website\deploy\node_modules\@icetee\ftp\lib\connection.js:1128:13) | |
at Parser.<anonymous> (C:\Users\User\Work\Local\mkv25-responsive-website\deploy\node_modules\@icetee\ftp\lib\connection.js:122:25) | |
at Parser.emit (events.js:182:13) | |
at Parser._write (C:\Users\User\Work\Local\mkv25-responsive-website\deploy\node_modules\@icetee\ftp\lib\parser.js:61:10) | |
at doWrite (_stream_writable.js:410:12) | |
at writeOrBuffer (_stream_writable.js:394:5) | |
at Parser.Writable.write (_stream_writable.js:294:11) | |
at Socket.ondata (C:\Users\User\Work\Local\mkv25-responsive-website\deploy\node_modules\@icetee\ftp\lib\connection.js:298:20) | |
at Socket.emit (events.js:182:13) | |
at addChunk (_stream_readable.js:283:12) | |
at readableAddChunk (_stream_readable.js:264:11) | |
at Socket.Readable.push (_stream_readable.js:219:10) | |
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) code: 501 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ftpDeploy = require('ftp-deploy') | |
const deployer = new ftpDeploy() | |
const fs = require('fs') | |
const path = require('path') | |
const passwords = JSON.parse(fs.readFileSync(path.join(__dirname, '.ftppass'))) | |
const mode = process.argv[2] || false | |
const defaultConfig = { | |
user: passwords['mkv25-stage'].username, | |
password: passwords['mkv25-stage'].password, // optional, prompted if none given | |
host: 'ftp.mkv25.net', | |
port: 21, | |
localRoot: path.join(__dirname, '../site'), | |
remoteRoot: '/site', | |
// include: ['*', '**/*'], // this would upload everything except dot files | |
include: [], // ['*.php', 'dist/*'], | |
exclude: ['.ftp*', '.git*', '.hta*', 'deploy', '*.fdproj', 'tasklist.md', 'readme.md', '.sublime'], // ['dist/**/*.map'], // e.g. exclude sourcemaps - ** exclude: [] if nothing to exclude ** | |
deleteRemote: false, // delete existing files at destination before uploading | |
forcePasv: true // Passive mode is forced (EPSV command is not sent) | |
} | |
const variations = { | |
'stage-images': { | |
include: ['images/**/*'] | |
}, | |
'stage-code': {}, | |
'stage-all': { | |
include: ['**/*'] | |
}, | |
'stage-php': {}, | |
'stage-php-lib': {}, | |
'stage-scripts': {}, | |
'stage-stylesheets': {}, | |
'stage-templates': {}, | |
'stage-content': {}, | |
'stage-articles': {}, | |
'stage-projects': {}, | |
'live-release': {} | |
} | |
deployer.on('uploading', function(data) { | |
console.log(data) | |
console.log('[Deploy] Uploading:', data.filename, ',', data.transferredFileCount, 'of', data.totalFilesCount, 'complete') | |
}) | |
deployer.on('uploaded', function(data) { | |
console.log(data) | |
console.log('[Deploy] Uploaded:', data.filename, ',', data.transferredFileCount, 'of', data.totalFilesCount, 'complete') | |
}) | |
deployer.on('log', function(data) { | |
console.log('[Deploy]', data) | |
}) | |
async function deploy(mode) { | |
const variation = variations[mode] || false | |
if (variation) { | |
const ftpConfig = Object.assign({}, defaultConfig, variation) | |
try { | |
console.log('[Deploy]', mode, ':', variation) | |
const result = await deployer.deploy(ftpConfig) | |
console.log('[Deploy] Finished:', result) | |
} | |
catch (ex) { | |
console.log('[Deploy] Error:', ex) | |
} | |
} else { | |
console.log(`[Deploy] No variation found for mode (${mode})`) | |
} | |
} | |
deploy(mode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment