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:
> ref-napi@2.1.2 install /mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ref-napi
> node-gyp-build
> ffi-napi@3.1.0 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 express-fileupload@1.3.1: 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: express-fileupload@1.3.1
npm WARN notsup Unsupported engine for javascript-obfuscator@2.19.1: 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: javascript-obfuscator@2.19.1
npm WARN notsup Unsupported engine for eslint-scope@6.0.0: 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: eslint-scope@6.0.0
npm WARN notsup Unsupported engine for commander@8.2.0: wanted: {"node":">= 12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: commander@8.2.0
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 fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN a3@1.0.1 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ffi-napi@3.1.0 install: `node-gyp-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ffi-napi@3.1.0 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!