运行“npm install”;在以前工作的 Node.js 项目上,现在出现错误。 (可能是“ffi-napi”包或“node-gyp”依赖项有问题)

发布于 2025-01-10 11:10:08 字数 9056 浏览 0 评论 0原文

我早在 2020 年 11 月就编写了一个网络应用程序,当时它运行得很好。
但现在当我下载它并尝试通过“npm install”安装它时,我遇到了大量错误。
如果有人想尝试的话,该项目位于此处:
https://github.com/pintof/Web-App---Contact-卡片
或者可以尝试在包含以下内容的 package.json 文件上运行“npm install”:

{
  "name": "a3",
  "version": "1.0.1",
  "description": "CIS2750 F20 - A3",
  "main": "app.js",
  "scripts": {
    "dev": "nodemon app.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1",
    "express-fileupload": "^1.2.0",
    "ffi-napi": "^3.0.1",
    "http": "0.0.1-security",
    "javascript-obfuscator": "^2.6.1",
    "mysql2": "^2.0.0",
    "nodemon": "^2.0.5"
  }
}

我假设错误是由于包/依赖关系问题造成的。
从错误的外观来看,它似乎与包“ffi-napi”或依赖项“node-gyp”有关。
我尝试从软件包版本中删除“^”,并尝试使用旧版本的“node-gyp”版本 7.1.2 准确地说,因为有些人注意到此版本之后新版本的错误,然后我的 package.json 看起来像这样:

{
  "name": "a3",
  "version": "1.0.1",
  "description": "CIS2750 F20 - A3",
  "main": "app.js",
  "scripts": {
    "dev": "nodemon app.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "4.17.1",
    "express-fileupload": "1.2.0",
    "ffi-napi": "3.0.1",
    "http": "0.0.1-security",
    "javascript-obfuscator": "2.6.1",
    "mysql2": "2.0.0",
    "nodemon": "2.0.5"
  },
  "devDependencies": {
    "node-gyp": "7.1.2"
  }
}

但我仍然遇到同样的错误。我在 linux 和 linux 上都遇到这些错误视窗。已经尝试过最新版本的node.js & npm,以及多个旧版本,例如 node.js 的版本 12、node.js 的版本 8,我什至不记得我尝试过的所有 npm 版本,但我现在非常确定更改节点。 js 版本或 npm 版本都无法解决问题,它更多地取决于包/依赖项。
我还尝试运行最新版本的“ffi-napi”& 'node-gyp',但得到完全相同的错误。
这是我的错误的屏幕截图: 错误屏幕截图

这是我的日志文件:
https://pintof.github.io/2022-02-28T07_08_19_080Z-debug。日志

以下是纯文本错误:

> [email protected] install /mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ref-napi
> node-gyp-build


> [email protected] install /mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi
> node-gyp-build

make: Entering directory '/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
  AR(target) Release/obj.target/../node-addon-api/src/nothing.a
  COPY Release/nothing.a
  CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/types.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/raw_api.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/java_raw_api.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/closures.o
../deps/libffi/src/closures.c: In function ‘dlmmap_locked’:
../deps/libffi/src/closures.c:421:7: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result]
  421 |       ftruncate (execfd, offset);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/libffi/src/closures.c:433:7: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result]
  433 |       ftruncate (execfd, offset);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi64.o
../deps/libffi/src/x86/ffi64.c: In function ‘classify_argument’:
../deps/libffi/src/x86/ffi64.c:181:18: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
  181 |    FFI_ASSERT (0);
      |                  ^
../deps/libffi/src/x86/ffi64.c:156:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
  156 |       {
      |       ^
../deps/libffi/src/x86/ffi64.c:183:5: note: here
  183 |     case FFI_TYPE_FLOAT:
      |     ^~~~
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/unix64.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/sysv.o
  AR(target) Release/obj.target/deps/libffi/libffi.a
  COPY Release/libffi.a
  CXX(target) Release/obj.target/ffi_bindings/src/ffi.o
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/node-addon-api: No such file or directory
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/get-uv-event-loop-napi-h/include: No such file or directory
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/get-symbol-from-current-process-h/include: No such file or directory
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ref-napi/include: No such file or directory
make: *** [ffi_bindings.target.mk:116: Release/obj.target/ffi_bindings/src/ffi.o] Error 1
make: Leaving directory '/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.4.0-19041-Microsoft
gyp ERR! command "/usr/bin/node" "/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi
gyp ERR! node -v v10.19.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.22.0 || ^14.17.0 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.22.0 || ^14.17.0 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">= 12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/floyd/.npm/_logs/2022-02-28T07_08_19_080Z-debug.log

任何解决方案将不胜感激!

I wrote a web app back in November 2020, and it was working perfectly fine then.
But now when I download it, and try to install it via 'npm install' I get a ton of errors.
The project is located here if anyone wants to try it:
https://github.com/pintof/Web-App---Contact-Cards
Or can just try running 'npm install' on a package.json file filled with the following contents:

{
  "name": "a3",
  "version": "1.0.1",
  "description": "CIS2750 F20 - A3",
  "main": "app.js",
  "scripts": {
    "dev": "nodemon app.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1",
    "express-fileupload": "^1.2.0",
    "ffi-napi": "^3.0.1",
    "http": "0.0.1-security",
    "javascript-obfuscator": "^2.6.1",
    "mysql2": "^2.0.0",
    "nodemon": "^2.0.5"
  }
}

I hypothesize that the errors are due to a package/dependency problem.
By the look of the errors it appears to be with the package 'ffi-napi' or the dependency 'node-gyp'.
I have tried removing the '^' from the package versions, and tried using an older version of 'node-gyp' version 7.1.2 to be precise as some people noted bugs with newer versions after this one, my package.json then looked like this:

{
  "name": "a3",
  "version": "1.0.1",
  "description": "CIS2750 F20 - A3",
  "main": "app.js",
  "scripts": {
    "dev": "nodemon app.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "4.17.1",
    "express-fileupload": "1.2.0",
    "ffi-napi": "3.0.1",
    "http": "0.0.1-security",
    "javascript-obfuscator": "2.6.1",
    "mysql2": "2.0.0",
    "nodemon": "2.0.5"
  },
  "devDependencies": {
    "node-gyp": "7.1.2"
  }
}

But I still got the same errors. I get these errors on both linux & windows. Have tried the newest version of node.js & npm, and multiple older versions like version 12 of node.js, version 8 of node.js, and I can't even remember all the many versions of npm I tried, but I'm quite sure by now that changing the node.js version or npm version will not fix the problem, and it lies more with the packages/dependencies.
I've also tried running the newest version of 'ffi-napi' & 'node-gyp', but get the exact same errors.
Here is a screenshot of my errors:
errors screenshot

Here is my log file:
https://pintof.github.io/2022-02-28T07_08_19_080Z-debug.log

And here are the errors in plain text:

> [email protected] install /mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ref-napi
> node-gyp-build


> [email protected] install /mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi
> node-gyp-build

make: Entering directory '/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
  AR(target) Release/obj.target/../node-addon-api/src/nothing.a
  COPY Release/nothing.a
  CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/types.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/raw_api.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/java_raw_api.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/closures.o
../deps/libffi/src/closures.c: In function ‘dlmmap_locked’:
../deps/libffi/src/closures.c:421:7: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result]
  421 |       ftruncate (execfd, offset);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/libffi/src/closures.c:433:7: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result]
  433 |       ftruncate (execfd, offset);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi64.o
../deps/libffi/src/x86/ffi64.c: In function ‘classify_argument’:
../deps/libffi/src/x86/ffi64.c:181:18: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
  181 |    FFI_ASSERT (0);
      |                  ^
../deps/libffi/src/x86/ffi64.c:156:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
  156 |       {
      |       ^
../deps/libffi/src/x86/ffi64.c:183:5: note: here
  183 |     case FFI_TYPE_FLOAT:
      |     ^~~~
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/unix64.o
  CC(target) Release/obj.target/ffi/deps/libffi/src/x86/sysv.o
  AR(target) Release/obj.target/deps/libffi/libffi.a
  COPY Release/libffi.a
  CXX(target) Release/obj.target/ffi_bindings/src/ffi.o
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/node-addon-api: No such file or directory
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/get-uv-event-loop-napi-h/include: No such file or directory
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/get-symbol-from-current-process-h/include: No such file or directory
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ref-napi/include: No such file or directory
make: *** [ffi_bindings.target.mk:116: Release/obj.target/ffi_bindings/src/ffi.o] Error 1
make: Leaving directory '/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.4.0-19041-Microsoft
gyp ERR! command "/usr/bin/node" "/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi
gyp ERR! node -v v10.19.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.22.0 || ^14.17.0 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.22.0 || ^14.17.0 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">= 12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/floyd/.npm/_logs/2022-02-28T07_08_19_080Z-debug.log

Any solutions would be greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文