1 javascript deployment heroku node.js typescript
我正在尝试通过将 Heroku 连接到我的 Github 存储库并部署 master 分支来将 Node.js 应用程序部署到 Heroku。
我尝试了多种不同的方法来部署我的应用程序,但所有方法都返回相同的错误。
确切的构建日志可以在下面找到:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 12.16.1
engines.npm (package.json): 6.13.4
engines.yarn (package.json): 1.19.1
Resolving node version 12.16.1...
Downloading and installing node 12.16.1...
npm 6.13.4 already installed with node
Resolving yarn version 1.19.1...
Downloading and installing yarn (1.19.1)...
Installed yarn 1.19.1
-----> Installing dependencies
Installing node modules (yarn.lock)
yarn install v1.19.1
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /tmp/build_6239d6c68cba3cabeb950e607f13b16d/node_modules/node-base64: Command failed.
Exit code: 127
Command: ./install.sh
Arguments:
Directory: /tmp/build_6239d6c68cba3cabeb950e607f13b16d/node_modules/node-base64
Output:
./install.sh: 3: ./install.sh: node-waf: not found
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
Run Code Online (Sandbox Code Playgroud)
我的package.json
文件可以在下面找到:
{
"engines": {
"node": "12.16.1",
"npm": "6.13.4",
"yarn": "1.19.1"
},
"scripts": {
"start": "tsc && node dist/app.js"
},
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"express-validator": "^6.4.0",
"jsonwebtoken": "^8.5.1",
"jwt": "^0.2.0",
"mongoose": "^5.7.11",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"passport-local": "^1.0.0",
"typescript": "^3.8.3"
},
"devDependencies": {
"@types/bcryptjs": "^2.4.2",
"@types/cors": "^2.8.6",
"@types/express": "^4.17.2",
"@types/jsonwebtoken": "^8.3.5",
"@types/mongoose": "^5.5.32",
"@types/passport-jwt": "^3.0.3",
"@types/passport-local": "^1.0.33",
"prettier": "1.19.1",
"tslint": "^5.20.1"
}
}
Run Code Online (Sandbox Code Playgroud)
感谢您提供的所有可能的解决方案。
TL;博士。删除jwt
并使用jsonwebtoken
。
详细信息:
jwt有node-base64作为依赖项。jwt 和 node-base64 都不再维护。在底层,node-base64 使用node-waf
的已经被弃用。因此,对已弃用包的调用循环导致了您遇到的失败。替换jwt
为jsonwebtoken
将解决此问题。
不使用 jwt也可能会遇到问题node-waf
。请参阅此 Stackoverflow 问题Node-waf:未找到来帮助您解决此问题。
归档时间: |
|
查看次数: |
1126 次 |
最近记录: |