无法在 NodeJS 应用程序中的 Heroku 上添加 npm 模块
Unable to add npm modules on Heroku in NodeJS app
我在 Heroku 上托管一个 NodeJS 应用程序,它重命名了 sFTP 服务器上的文件。请在下面找到我的 app.js 代码。如果我删除 ssh2-sftp-client npm 模块,一切正常。但后来我无法进行 sFTP 连接。我对 Heroku 和 NodeJS 都很陌生。你能帮我解决这个问题吗?在本地一切都是工作文件。我对如何将 npm ssh2-sftp-client 添加到 Heroku 以正确执行 nodeJS 代码感到困惑。
let Client = require('ssh2-sftp-client');
let sftp = new Client();
sftp.connect({
host: 'host',
port: 'port',
username: 'user',
password: 'password'
}).then(() => {
return sftp.rename('/After30/Sunil.txt','/After30/Sunil.csv')
}).then(() => {
console.log('Closing SFTP');
return sftp.end();
}).catch(err => {
console.log(err, 'catch error');
});
请查找package.json文件代码,
{
"name": "jb-activity-template",
"version": "1.0.0",
"description": "Journey Builder Activity Template",
"engines": {
"node": "6.11.1"
},
"scripts": {
"start": "node app.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bhanuatsfdc/SFMC/journey-builder-activity-template.git"
},
"keywords": [
"journey",
"builder",
"salesforce marketing cloud",
"heroku"
],
"author": "Devs United",
"license": "ISC",
"bugs": {
"url": "https://github.com/bhanuatsfdc/SFMC/journey-builder-activity-template/issues"
},
"homepage": "https://github.com/bhanuatsfdc/SFMC/journey-builder-activity-template#readme",
"dependencies": {
"body-parser": "^1.18.2",
"bower": "^1.8.0",
"errorhandler": "^1.5.0",
"express": "^4.15.4",
"jsonwebtoken": "^8.0.1",
"ssh2-sftp-client": "^5.0.1",
"request": "^2.81.0",
"require": "^2.4.20"
}
}
请找到我的应用日志快照,
在 package.json 中更改节点 js 引擎版本后开始工作(放入最新版本)
我在 Heroku 上托管一个 NodeJS 应用程序,它重命名了 sFTP 服务器上的文件。请在下面找到我的 app.js 代码。如果我删除 ssh2-sftp-client npm 模块,一切正常。但后来我无法进行 sFTP 连接。我对 Heroku 和 NodeJS 都很陌生。你能帮我解决这个问题吗?在本地一切都是工作文件。我对如何将 npm ssh2-sftp-client 添加到 Heroku 以正确执行 nodeJS 代码感到困惑。
let Client = require('ssh2-sftp-client');
let sftp = new Client();
sftp.connect({
host: 'host',
port: 'port',
username: 'user',
password: 'password'
}).then(() => {
return sftp.rename('/After30/Sunil.txt','/After30/Sunil.csv')
}).then(() => {
console.log('Closing SFTP');
return sftp.end();
}).catch(err => {
console.log(err, 'catch error');
});
请查找package.json文件代码,
{
"name": "jb-activity-template",
"version": "1.0.0",
"description": "Journey Builder Activity Template",
"engines": {
"node": "6.11.1"
},
"scripts": {
"start": "node app.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bhanuatsfdc/SFMC/journey-builder-activity-template.git"
},
"keywords": [
"journey",
"builder",
"salesforce marketing cloud",
"heroku"
],
"author": "Devs United",
"license": "ISC",
"bugs": {
"url": "https://github.com/bhanuatsfdc/SFMC/journey-builder-activity-template/issues"
},
"homepage": "https://github.com/bhanuatsfdc/SFMC/journey-builder-activity-template#readme",
"dependencies": {
"body-parser": "^1.18.2",
"bower": "^1.8.0",
"errorhandler": "^1.5.0",
"express": "^4.15.4",
"jsonwebtoken": "^8.0.1",
"ssh2-sftp-client": "^5.0.1",
"request": "^2.81.0",
"require": "^2.4.20"
}
}
请找到我的应用日志快照,
在 package.json 中更改节点 js 引擎版本后开始工作(放入最新版本)