I was trying to deploy my master branch files to FTP server (cpanel, apache) using CircleCI . And I’m following instruction describe here in this article.
But I’m getting error on "node .circleci/deploy.js"
Here is the full error log:
#!/bin/bash -eo pipefail node .circleci/deploy.js internal/modules/cjs/loader.js:605
throw err;
^
Error: Cannot find module '/home/circleci/project/.circleci/deploy.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)
at executeUserCode (internal/bootstrap/node.js:342:17)
at startExecution (internal/bootstrap/node.js:276:5)
at startup (internal/bootstrap/node.js:227:5)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3) Exited with code 1
Here is my config.yml and config.js file inside “.circleci” folder.
version: 2
jobs:
build:
docker:
- image: circleci/node:latest
steps:
- checkout
- run: npm install
- run: node .circleci/deploy.js
- run: echo "WE'RE ONLINE"
workflows:
version: 2
deploy:
jobs:
- build:
filters:
branches:
only:
- master
Config.js file
var FtpDeploy = require('ftp-deploy');
var ftpDeploy = new FtpDeploy();
var config = {
username: process.env.USERNAME_HV,
password: process.env.PASSWORD_HV,
host: process.env.FTPHOST,
port: 21,
localRoot: __dirname + "/",
remoteRoot: "/home/hiversho/public_html/gitlab-pipeline-demo/",
include: ['*']
}
ftpDeploy.deploy(config, function(err) {
if (err) console.log(err)
else console.log('finished');
});
In case anyone want to check the entire repo files, checkout on github