0

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!

pintof
  • 1
  • 1
  • `g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/node-addon-api: No such file or directory` Is a pretty clear error message in my opinion. If you look in your git repo inside the `include` folder, there is no "node_modules" folder. – Marc Feb 28 '22 at 08:29
  • Hi Marc, thanks for the response. So as far as I know, not having a `node_modules` folder is normal, and even preferred, as its supposed to get created when you run the `npm install` command which installs all the needed packages & dependencies that were listed in the `package.json` file. You actually don't even need my repo to problem solve this kind of problem, just running `npm install` on the `package.json` (whose contents I copied & pasted into the OP) should be everything a troubleshooter needs. – pintof Mar 01 '22 at 10:30
  • From the error messages, it appears like some sort of dependency within the `node_modules` folder is not getting downloaded, or is missing, possibly a version problem with a dependency, I don't know. But I do know `npm install` would execute perfectly fine on this project back in Nov 2020, and some of the dependencies were probably different versions back then. – pintof Mar 01 '22 at 10:34
  • A "node_modules" folder is only created on the same directory as your package.json. Its confusing why it trys to load something from "node_moduls" inside your "include" folder. What was your CWD when you typed `npm install`? – Marc Mar 01 '22 at 10:39
  • So I usually run `npm install` from the root of the repo directory, in the particular example above I had copy & pasted the `package.json` file to the `include` folder, and ran `npm install` from within this folder. The errors are always the exact same though, regardless of what folder `package.json` is in, and whether the rest of the repo even exists or not. Here are the errors from me running `npm install` from the root of the repo folder: ![Screenshot of errors](https://i.ibb.co/VWHrTL2/errors.jpg) – pintof Mar 02 '22 at 20:41
  • Sorry disregard that screenshot, it is of an unreadably low resolution. Here is a better one: [Screenshot of errors](https://i.imgur.com/J8VaU77.jpg) – pintof Mar 02 '22 at 20:53
  • Do you have all requirements fullfiled for `node-gyp`? Since your are on WSL: https://github.com/nodejs/node-gyp#on-unix – Marc Mar 02 '22 at 21:14
  • yup I have all the requirements fulfilled. I had 'python3' installed, just now tried installing 'python-is-python3' instead. And now all my GCC errors are gone, and I have new Python related errors. [Screenshot of errors](https://i.imgur.com/J3CNfaL.jpg) – pintof Mar 04 '22 at 03:51
  • Please update your question with what you have done (to "resolve" the previous error) and tell me what exact python verison you have installed. – Marc Mar 04 '22 at 07:16

0 Answers0