为什么我的节点应用程序无法在 ec2 实例上的 amazon linux 2 AMI 上启动并显示此错误?
why my node app don't start on amazon linux 2 AMI on ec2 instance and showing this error?
我已将所有文件正确传输到我的 ec2 实例,并且所有节点模块都使用 package.json 文件成功下载,我的 ec2 实例的 OS 是 Amazon linux 2 ,但是每当我在终端上 运行 npm start 时,我都会收到以下错误。我已经搜索了很多,并在网上关注了许多类似或相同的问题,但仍然无法弄清楚。
终端说:-
[ec2-user@ip-172-31-7-38 backbenchers]$ npm start
> learners-backend@1.0.0 start
> nodemon app.js
[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node app.js`
the-backbenchers.herokuapp.com
undefined
0.0.0.0
/home/ec2-user/backbenchers/node_modules/bindings/bindings.js:135
throw err;
^
Error: Could not locate the bindings file. Tried:
→ /home/ec2-user/backbenchers/node_modules/deasync/build/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/build/Debug/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/build/Release/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/out/Debug/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/Debug/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/out/Release/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/Release/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/build/default/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/compiled/15.3.0/linux/x64/de async.node
→ /home/ec2-user/backbenchers/node_modules/deasync/addon-build/release/install- root/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/addon-build/debug/install-ro ot/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/addon-build/default/install- root/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/lib/binding/node-v88-linux-x 64/deasync.node
at bindings (/home/ec2-user/backbenchers/node_modules/bindings/bindings.js:1 26:9)
at Object.<anonymous> (/home/ec2-user/backbenchers/node_modules/deasync/inde x.js:30:31)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/home/ec2-user/backbenchers/node_modules/locus/src/lo cus.js:6:12)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/home/ec2-user/backbenchers/routes/posts.js:14:13) {
tries: [
'/home/ec2-user/backbenchers/node_modules/deasync/build/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/build/Debug/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/build/Release/deasync.node ',
'/home/ec2-user/backbenchers/node_modules/deasync/out/Debug/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/Debug/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/out/Release/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/Release/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/build/default/deasync.node ',
'/home/ec2-user/backbenchers/node_modules/deasync/compiled/15.3.0/linux/x64/ deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/addon-build/release/instal l-root/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/addon-build/debug/install- root/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/addon-build/default/instal l-root/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/lib/binding/node-v88-linux -x64/deasync.node'
]
}
[nodemon] app crashed - waiting for file changes before starting...
节点版本为 v15.3.0
npm 版本为 v7.0.14
nvm 版本为 0.34.0
请帮我解决这个问题。
我将节点版本降级到 12.0.0 。现在一切正常
我已将所有文件正确传输到我的 ec2 实例,并且所有节点模块都使用 package.json 文件成功下载,我的 ec2 实例的 OS 是 Amazon linux 2 ,但是每当我在终端上 运行 npm start 时,我都会收到以下错误。我已经搜索了很多,并在网上关注了许多类似或相同的问题,但仍然无法弄清楚。
终端说:-
[ec2-user@ip-172-31-7-38 backbenchers]$ npm start
> learners-backend@1.0.0 start
> nodemon app.js
[nodemon] 2.0.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node app.js`
the-backbenchers.herokuapp.com
undefined
0.0.0.0
/home/ec2-user/backbenchers/node_modules/bindings/bindings.js:135
throw err;
^
Error: Could not locate the bindings file. Tried:
→ /home/ec2-user/backbenchers/node_modules/deasync/build/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/build/Debug/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/build/Release/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/out/Debug/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/Debug/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/out/Release/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/Release/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/build/default/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/compiled/15.3.0/linux/x64/de async.node
→ /home/ec2-user/backbenchers/node_modules/deasync/addon-build/release/install- root/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/addon-build/debug/install-ro ot/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/addon-build/default/install- root/deasync.node
→ /home/ec2-user/backbenchers/node_modules/deasync/lib/binding/node-v88-linux-x 64/deasync.node
at bindings (/home/ec2-user/backbenchers/node_modules/bindings/bindings.js:1 26:9)
at Object.<anonymous> (/home/ec2-user/backbenchers/node_modules/deasync/inde x.js:30:31)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/home/ec2-user/backbenchers/node_modules/locus/src/lo cus.js:6:12)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/home/ec2-user/backbenchers/routes/posts.js:14:13) {
tries: [
'/home/ec2-user/backbenchers/node_modules/deasync/build/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/build/Debug/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/build/Release/deasync.node ',
'/home/ec2-user/backbenchers/node_modules/deasync/out/Debug/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/Debug/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/out/Release/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/Release/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/build/default/deasync.node ',
'/home/ec2-user/backbenchers/node_modules/deasync/compiled/15.3.0/linux/x64/ deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/addon-build/release/instal l-root/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/addon-build/debug/install- root/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/addon-build/default/instal l-root/deasync.node',
'/home/ec2-user/backbenchers/node_modules/deasync/lib/binding/node-v88-linux -x64/deasync.node'
]
}
[nodemon] app crashed - waiting for file changes before starting...
节点版本为 v15.3.0
npm 版本为 v7.0.14
nvm 版本为 0.34.0
请帮我解决这个问题。
我将节点版本降级到 12.0.0 。现在一切正常