nodenv / node-build-update-defs

Scrape build definitions from nodejs.org and github.com
MIT License
36 stars 7 forks source link

Homebrew install doesn't seem to work #39

Closed LoganBarnett closed 5 years ago

LoganBarnett commented 5 years ago

With a fresh install of node-build-update-defs from Homebrew, I get this error when trying to run nodenv update-version-defs:

© nodenv update-version-defs                                         
internal/modules/cjs/loader.js:626
    throw err;
    ^

Error: Cannot find module './lib/definition-file'
Require stack:
- /usr/local/Cellar/node-build-update-defs/2.9.1/index.js
- /usr/local/Cellar/node-build-update-defs/2.9.1/[stdin]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15)
    at Function.Module._load (internal/modules/cjs/loader.js:527:27)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/usr/local/Cellar/node-build-update-defs/2.9.1/index.js:1:24)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/Cellar/node-build-update-defs/2.9.1/index.js',
    '/usr/local/Cellar/node-build-update-defs/2.9.1/[stdin]'
  ]
}
$ echo $NODE_BUILD_DEFINITIONS
/usr/local/opt/node-build-update-defs/share/node-build

Might be related to #9.

From what I can tell in #9, it looks like a Homebrew directive was added to do a rewrite of "lib" to "src" in order to satisfy Homebrew's somewhat reserved meaning of "lib". I checked the locally installed files and index.js indeed still uses the lib prefix, yet there is no lib directory present (but src is there).

Manually editing index.js to use src instead of lib fixes the issue. I'm not blocked by it, but will need to repeat the edits if I am to reinstall or upgrade this package. I am unfamiliar with the inner workings of Homebrew, but I suspect something about their replacement mechanism has either changed or it is no longer honored?

When doing a reinstall, this is the dump I saw:

✎ brew reinstall nodenv/nodenv/node-build-update-defs
==> Reinstalling nodenv/nodenv/node-build-update-defs 
==> Downloading https://github.com/nodenv/node-build-update-defs/archive/v2.9.1.tar.gz
Already downloaded: /Users/logan/Library/Caches/Homebrew/downloads/bf5ad909eeb49a38b35ee3823ed57f8c753f4580fb8018be184a355df0e3e69f--node-build-update-defs-2.9.1.tar.gz
==> Caveats
For `node-build`/`nodenv install` to pick up definitions written by this plugin,
ensure directory exists in NODE_BUILD_DEFINITIONS:
    export NODE_BUILD_DEFINITIONS="/usr/local/opt/node-build-update-defs/share/node-build"
==> Summary
🍺  /usr/local/Cellar/node-build-update-defs/2.9.1: 22 files, 132.5KB, built in 3 seconds

Thanks for maintaining this project!

vky commented 5 years ago

I've run into the same issue. Have the same versions of everything mentioned here as well.