NodeJS Elastic Beanstalk环境错误:找不到模块 ‘node-linux-arm64/package.json’。

huangapple go评论75阅读模式
英文:

NodeJS Elastic Beanstalk environment error Cannot find module 'node-linux-arm64/package.json'

问题

I am having issues getting my Node.js project to run on AWS Elastic Beanstalk.

It was running fine for months, but after the Christmas break, it is now failing.

Here is the output from the eb-engine.log file:

[INFO] 使用npm安装依赖项
[INFO] 正在运行命令/bin/sh -c npm config set jobs 1
[INFO] 正在运行命令/bin/sh -c npm --production install

npm ERR! code 1
npm ERR! path /var/app/staging/node_modules/node
npm ERR! command failed
npm ERR! command sh -c node installArchSpecificPackage
npm ERR! node:internal/modules/cjs/loader:936
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! Error: 无法找到模块 'node-linux-arm64/package.json'
npm ERR! Require stack:
npm ERR! - /var/app/staging/node_modules/node/installArchSpecificPackage.js
npm ERR! 在 Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
npm ERR! 在 Function.resolve (node:internal/modules/cjs/helpers:108:19)
npm ERR! 在 ChildProcess.<anonymous> (/var/app/staging/node_modules/node-bin-setup/index.js:19:27)
npm ERR! 在 ChildProcess.emit (node:events:527:28)
npm ERR! 在 maybeClose (node:internal/child_process:1092:16)
npm ERR! 在 Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
npm ERR! code: 'MODULE_NOT_FOUND',
npm ERR! requireStack: [
npm ERR! '/var/app/staging/node_modules/node/installArchSpecificPackage.js'
npm ERR! ]
npm ERR! } ```

This is using the "Node.js 16 running on 64bit Amazon Linux 2/5.6.3" platform.

Any help would be greatly appreciated.

<details>
<summary>英文:</summary>

I am having issues getting my Node.js project to run on AWS Elastic Beanstalk. 

It was running fine for months, but after the Christmas break, it is now failing.

Here is the output from the eb-engine.log file:

[INFO] Executing instruction: Use NPM to install dependencies
[INFO] use npm to install dependencies
[INFO] Running command /bin/sh -c npm config set jobs 1
[INFO] Running command /bin/sh -c npm --production install

npm ERR! code 1
npm ERR! path /var/app/staging/node_modules/node
npm ERR! command failed
npm ERR! command sh -c node installArchSpecificPackage
npm ERR! node:internal/modules/cjs/loader:936
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! Error: Cannot find module 'node-linux-arm64/package.json'
npm ERR! Require stack:
npm ERR! - /var/app/staging/node_modules/node/installArchSpecificPackage.js
npm ERR! at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
npm ERR! at Function.resolve (node:internal/modules/cjs/helpers:108:19)
npm ERR! at ChildProcess.<anonymous> (/var/app/staging/node_modules/node-bin-setup/index.js:19:27)
npm ERR! at ChildProcess.emit (node:events:527:28)
npm ERR! at maybeClose (node:internal/child_process:1092:16)
npm ERR! at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
npm ERR! code: 'MODULE_NOT_FOUND',
npm ERR! requireStack: [
npm ERR! '/var/app/staging/node_modules/node/installArchSpecificPackage.js'
npm ERR! ]
npm ERR! }


This is using the &quot;Node.js 16 running on 64bit Amazon Linux 2/5.6.3&quot; platform.

Any help would be greatly appreciated.


</details>


# 答案1
**得分**: 0

问题是由我的一个项目依赖项引起的。

在该依赖项的源代码中,它需要一个不同版本的Node在其`package.json`中。

从我们的应用程序中移除对该模块的依赖解决了这个问题。

<details>
<summary>英文:</summary>

Hopefully, this helps someone else if they experience this same issue.

The issue was caused by one of my project dependencies.

Within the source code of this dependency, it was requiring a different version of node within its `package.json`.

Removing the dependency on the module within our app resolved the problem.

</details>



huangapple
  • 本文由 发表于 2023年1月5日 18:01:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/75016692.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定