我试图使用CircleCI将主分支文件部署到FTP服务器(cpanel,apache)。我正在按照说明here in this article进行操作。
但是我在“ node .circleci / deploy.js”
上遇到了错误这是完整的错误日志:
#!/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
这是我的 config.yml 和config.js文件,位于“ .circleci”文件夹中。
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文件
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');
});
如果有人想检查整个回购文件,checkout on github
答案 0 :(得分:0)
在存储库中,您的文件名为.circleci / config.js ,而您正在尝试运行.circleci / deploy.js