mapbox / node-pre-gyp

Node.js tool for easy binary deployment of C++ addons
BSD 3-Clause "New" or "Revised" License
1.11k stars 263 forks source link

Bizarre errors in npm install... #678

Closed wobbet closed 1 year ago

wobbet commented 1 year ago

Windows 10 Coding in VS Code (latest) Visual Studio Professional with C/C++ dev tool chain for both VS 2022 and VS 2019 installed. cmake 3.26.0-rc4

; userconfig C:\Users\xzyyz.npmrc msvs_version = "2019" python = "d:\program files\python310"

I've tried setting msvs_version to 2022 but it isn't appreciated.

Node is installed via nvm

Started with Electron React Boilerplate and it worked out of the box.

Added opencv-ts and face-api.js and was able to get a demo app running showing live video from webcam and snapshots of facial landmarks updating in a canvas element.

Started working on some additional face-api based code to pull some additional features out of the facial landmarks.

Went to bed. Woke up to machine that had been force rebooted by Windows update.

Load up VS Code, hit F5 to launch and start getting webpack errors. Reverted a bunch of changes and instead of webpack errors, I'm now getting build errors from @mapbox/node-pre-gyp.

Dropped all of node_modules and package lock file.

running npm i to get the world back in place and still getting build errors from @mapbox/node-pre-gyp.

I have obviously honked something up and have no clue how to proceed.

With thanks...

ERROR in ./node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <!doctype html>
| <html>
| <head>
 @ ./node_modules/@mapbox/node-pre-gyp/lib/ sync ^\.\/.*$ ./util/nw-pre-gyp/index.html
 @ ./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 86:13-36 291:36-53
 @ ./node_modules/@tensorflow/tfjs-node/dist/index.js 55:13-44
 @ dll renderer renderer[0]

ERROR in ./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js 43:20-42
Module not found: Error: Can't resolve 'mock-aws-s3' in 'D:\wobbet\projects\eyebox\node_modules\@mapbox\node-pre-gyp\lib\util'
 @ ./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 15:21-62
 @ ./node_modules/@tensorflow/tfjs-node/dist/index.js 55:13-44
 @ dll renderer renderer[0]

ERROR in ./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js 76:14-32
Module not found: Error: Can't resolve 'aws-sdk' in 'D:\projects\eyebox\node_modules\@mapbox\node-pre-gyp\lib\util'
 @ ./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 15:21-62
 @ ./node_modules/@tensorflow/tfjs-node/dist/index.js 55:13-44
 @ dll renderer renderer[0]

ERROR in ./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js 112:15-30
Module not found: Error: Can't resolve 'nock' in 'D:\projects\eyebox\node_modules\@mapbox\node-pre-gyp\lib\util'
 @ ./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js 15:21-62
 @ ./node_modules/@tensorflow/tfjs-node/dist/index.js 55:13-44
 @ dll renderer renderer[0]

ERROR in ./node_modules/node-gyp/lib/Find-VisualStudio.cs 9:6
Module parse failed: Unexpected token (9:6)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| // This script needs to be compatible with PowerShell v2 to run on Windows 2008R2 and Windows 7.
|
> using System;
| using System.Text;
| using System.Runtime.InteropServices;
 @ ./node_modules/node-gyp/lib/ sync ^\.\/.*$ ./Find-VisualStudio.cs
 @ ./node_modules/node-gyp/lib/node-gyp.js 41:13-36 195:36-53
 @ dll renderer renderer[5]
wobbet commented 1 year ago

Not sure if it's useful but there are two references to pre-gyp in my package-lock.json...

    "@tensorflow/tfjs-node": {
      "version": "4.2.0",
      "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.2.0.tgz",
      "integrity": "sha512-dkyExfqTjMVDpKLBzHH2b7JWzGK+QORtYswvoNHbeHwx7kvYYRAQeiHxp+xrgry6LdbWfZs88IWCwNGoOiZ21w==",
      "requires": {
        "@mapbox/node-pre-gyp": "1.0.9",

and

    "@mapbox/node-pre-gyp": {
      "version": "1.0.9",
      "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.9.tgz",
      "integrity": "sha512-aDF3S3rK9Q2gey/WAttUlISduDItz5BU3306M9Eyv6/oS40aMprnopshtlKTykxRNIBEZuRMaZAnbrQ4QtKGyw==",
wobbet commented 1 year ago

I have completely rebuilt my project from scratch with two modifications

I'm confident the first library was the one at issue.

I'm back up and running.

Closing.