lucascaro / hexo-deployer-sftp

SFTP deployer for Hexo
MIT License
7 stars 5 forks source link

TypeError: str.replace is not a function #10

Closed nnnewb closed 3 years ago

nnnewb commented 3 years ago
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
  type: sftp
  host: myhost.com
  user: myuser
  pass: ""
  remotePath: ["/var/www/html/myhost.com/blog"]
  port: [22]
  privateKey: ["~/.ssh/id_rsa"]
  passphrase: []
  agent: []

hexo deploy output

INFO  Validating config
INFO  Deploying: sftp
Deploying with configuration:  {
  dryRun: false,
  forceUpload: undefined,
  excludeMode: 'remove',
  concurrency: 100
}
FATAL {
  err: TypeError: str.replace is not a function
      at Object.chomp (C:\Users\weakptr\source\repos\blog\node_modules\sftp-sync-deploy\lib\util.js:14:16)     
      at new SftpSync (C:\Users\weakptr\source\repos\blog\node_modules\sftp-sync-deploy\lib\sftpSync.js:34:34) 
      at Object.deploy (C:\Users\weakptr\source\repos\blog\node_modules\sftp-sync-deploy\index.js:9:22)        
      at Hexo.<anonymous> (C:\Users\weakptr\source\repos\blog\node_modules\hexo-deployer-sftp\index.js:56:15)  
      at Hexo.tryCatcher (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\util.js:16:23)   
      at Hexo.<anonymous> (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\method.js:15:34)
      at C:\Users\weakptr\source\repos\blog\node_modules\hexo\lib\plugins\console\deploy.js:53:20
      at tryCatcher (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\util.js:16:23)        
      at Object.gotValue (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\reduce.js:166:18)
      at Object.gotAccum (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\reduce.js:155:25)
      at Object.tryCatcher (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\util.js:16:23)
      at Promise._settlePromiseFromHandler (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\promise.js:547:31)
      at Promise._settlePromise (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\promise.js:604:18)
      at Promise._settlePromiseCtx (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\promise.js:641:10)
      at _drainQueueStep (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\async.js:97:12)
      at _drainQueue (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\async.js:86:9)
      at Async._drainQueues (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\weakptr\source\repos\blog\node_modules\bluebird\js\release\async.js:15:14)
      at processImmediate (node:internal/timers:463:21)
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

hexo-deployer-sftp version: v0.4.1

Hexo version:

INFO  Validating config
hexo: 5.3.0
hexo-cli: 4.2.0
os: Windows_NT 10.0.19041 win32 x64
node: 15.5.0
v8: 8.6.395.17-node.23
uv: 1.40.0
zlib: 1.2.11
brotli: 1.0.9
ares: 1.17.1
modules: 88
nghttp2: 1.41.0
napi: 7
llhttp: 2.1.3
openssl: 1.1.1i
cldr: 38.0
icu: 68.1
tz: 2020b
unicode: 13.0

the usage documents are too vague, don't known how to fix it.

nnnewb commented 3 years ago

Okay, my fault.

I misunderstand the square brackets. It means OPTIONAL, not array.

This configure works for me.

# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
  type: sftp
  host: myhost.com
  user: myuser
  pass: ""
  remotePath: /var/www/html/myhost.com/blog
  port: 22
  privateKey: ~/.ssh/id_rsa

Still, the usage documents are too vague, should clarify it.

lucascaro commented 3 years ago

Thanks for the feedback! note that the documentation you are referring to is on a different project and uses the square bracket nomenclature for all optional parameters, I'm sure they would welcome any PRs making the docs more clear. Closing this since it's not related to this code base in particular.