b0o / surfingkeys-conf

🏄 A SurfingKeys config which adds 180+ key mappings & 50+ search engines
MIT License
395 stars 67 forks source link

[Bug] Error: Cannot find module 'object-assign' #66

Closed blacklight closed 1 year ago

blacklight commented 2 years ago

This error occurs when running npm install on the latest main branch:

$ npm install                                                                                                                                                                                                                             
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm ERR! code 1
npm ERR! path /home/blacklight/tmp/surfingkeys-conf/node_modules/platform-folders
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
npm ERR! node:internal/modules/cjs/loader:988
npm ERR!   throw err;
npm ERR!   ^
npm ERR!
npm ERR! Error: Cannot find module 'object-assign'
npm ERR! Require stack:
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/render-template.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/plumbing.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/index.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/npmlog/log.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js
npm ERR! - /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
npm ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:833:27)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1051:19)
npm ERR!     at require (node:internal/modules/cjs/helpers:103:18)
npm ERR!     at Object.<anonymous> (/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/render-template.js:4:20)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1149:14)
npm ERR!     at Module._extensions..js (node:internal/modules/cjs/loader:1203:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1027:32)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:868:12)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1051:19) {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: [
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/render-template.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/plumbing.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/gauge/index.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/node_modules/npmlog/log.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js',
npm ERR!     '/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js'
npm ERR!   ]
npm ERR! }
npm ERR!
npm ERR! Node.js v18.10.0
b0o commented 2 years ago

I'm not able to reproduce this. Can you please try to rm -rf node_modules, git checkout package-lock.json, and then npm install again?

blacklight commented 2 years ago

I have tried from a fresh git clone too, no luck. I have also tried to build it on another machine, but there I get another error (most likely due to some installation script of platform-folders still using the Python 2 syntax):

npm install                                                                                                                                                                                                                             ─╯
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm ERR! code 1
npm ERR! path /home/blacklight/tmp/surfingkeys-conf/node_modules/platform-folders
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.16.0 | linux | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: /sbin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:398:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
npm ERR! gyp ERR! stack     at Socket.<anonymous> (node:internal/child_process:451:11)
npm ERR! gyp ERR! stack     at Socket.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at Pipe.<anonymous> (node:net:709:12)
npm ERR! gyp ERR! System Linux 5.17.5-x86_64-linode154
npm ERR! gyp ERR! command "/usr/bin/node" "/home/blacklight/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /home/blacklight/tmp/surfingkeys-conf/node_modules/platform-folders
npm ERR! gyp ERR! node -v v16.16.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
b0o commented 2 years ago

For the original issue: I've pushed some changes, updating and cleaning up dependencies. Please try with a fresh clone. Not sure it will fix anything, but it's worth a shot. If it doesn't fix the issue, please let me know what OS you're using, as well as the following:

npm --version
node --version
node-gyp --version
which npm node node-gyp

It seems like there might possibly be a problem with your system installation of node or node-gyp. You could try re-installing.

For the second issue: https://github.com/kingjan1999/platform-folders/issues/13

blacklight commented 1 year ago

Sorry for the delay, I've just had some time to test the build process again and I can confirm that it works!

The latest commits have fixed the object-assign issue.

The Python 2 legacy syntax of node-gyp was instead caused by a very old installation of node-gyp under ~/node_modules, wiping the folder forced defaulting to the system-provided version.

Thanks again for the support!