royaltm / node-murmurhash-native

MurmurHash native bindings for node
MIT License
48 stars 7 forks source link

Build error when falling back to source when installing via yarn. #26

Open overhub-edvin opened 2 years ago

overhub-edvin commented 2 years ago

I'm experiencing a strange error with murmurhash-native when it is installed via yarn and is forced to be built from source using node-pre-gyp.

I am running on OSX Big Sur, via the latest update of nvm, and node 16.13.1 with yarn 1.22.15. But this same exact error occurs on my docker container when building via CircleCI, so I know it is not platform specfic.

If I nuke yarn.lock and node_modules and run yarn I get the following error:

yarn install v1.22.15
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] πŸ”—  Linking dependencies...
warning " > objection@2.2.18" has incorrect peer dependency "knex@<0.95.0".
warning Workspaces can only be enabled in private projects.
[4/4] πŸ”¨  Building fresh packages...
[1/3] β‘€ murmurhash-native
[2/3] β‘€ unix-dgram
error /Users/some-user/Documents/Projects/some-project/node_modules/murmurhash-native: Command failed.
Exit code: 7
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /Users/some-user/Documents/Projects/some-project/node_modules/murmurhash-native
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.14.0
node-pre-gyp info using node@16.13.1 | darwin | x64
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp info check checked for "/Users/some-user/Documents/Projects/some-project/node_modules/murmurhash-native/lib/Release/murmurhash.node" (not found)
node-pre-gyp http GET https://github.com/royaltm/node-murmurhash-native/releases/download/v3.5.0/murmurhash-v3.5.0-node-v93-darwin-x64.tar.gz
node-pre-gyp ERR! UNCAUGHT EXCEPTION
node-pre-gyp ERR! stack TypeError: options.callback is not a function
node-pre-gyp ERR! stack     at Request.<anonymous> (/Users/some-user/Documents/Projects/some-project/node_modules/request/main.js:290:21)
node-pre-gyp ERR! stack     at Request.emit (node:events:390:28)
node-pre-gyp ERR! stack     at IncomingMessage.<anonymous> (/Users/some-user/Documents/Projects/some-project/node_modules/request/main.js:278:54)
node-pre-gyp ERR! stack     at IncomingMessage.emit (node:events:402:35)
node-pre-gyp ERR! stack     at endReadableNT (node:internal/streams/readable:1343:12)
node-pre-gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
node-pre-gyp ERR! System Darwin 20.6.0
node-pre-gyp ERR! command "/Users/some-user/.nvm/versions/node/v16.13.1/bin/node" "/Users/some-user/Documents/Projects/some-project/node_modules/murmurhash-native/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/some-user/Documents/Projects/some-project/node_modules/murmurhash-native
node-pre-gyp ERR! node -v v16.13.1
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! This is a bug in `node-pre-gyp`.
node-pre-gyp ERR! Try to update node-pre-gyp and file an issue if it does not help:

If I create a new project, with a new package.json and only installed murmurhash-native, then yarn is able to install it correctly.

If I install the package independently using the command npm i murmurhash-native --build-from-source, then it installs correctly. So I know I am able to build it on my computer.

These problems started when I upgraded to node 16, since it is the new LTS build. I don't quite know what to make of it.

Thank you for your time. :)

Here are the relevant portions of my package.json

  "devDependencies": {
    "@babel/core": "^7.15.8",
    "@babel/plugin-proposal-class-properties": "^7.14.5",
    "@babel/preset-env": "^7.15.8",
    "@types/jest": "^26.0.23",
    "@types/mathjs": "^9.4.2",
    "chalk": "^4.1.2",
    "eslint": "^8.4.1",
    "jest": "^26.6.3",
    "jsdoc": "^3.6.7",
    "node-gyp": "^8.4.1",
    "node-pre-gyp": "^0.17.0",
    "nodemon": "^2.0.12",
    "prettier": "^2.3.0",
    "rosie": "^2.1.0",
    "stack-trace": "^0.0.10",
    "supertest": "^6.1.3"
  },
  "dependencies": {
    "@aws-crypto/client-node": "^1.0.3",
    "@bull-board/api": "^3.6.0",
    "@bull-board/express": "^3.6.0",
    "@casl/ability": "^5.3.1",
    "@elastic/elasticsearch": "^7.4.0",
    "@feathers-plus/validate-joi": "^3.2.1",
    "@feathersjs/authentication": "^4.5.11",
    "@feathersjs/authentication-local": "^4.5.11",
    "@feathersjs/configuration": "^4.5.11",
    "@feathersjs/errors": "^4.5.11",
    "@feathersjs/express": "^4.5.11",
    "@feathersjs/feathers": "^4.5.11",
    "@feathersjs/hooks": "^0.6.5",
    "@paypal/checkout-server-sdk": "^1.0.2",
    "@sentry/node": "^6.5.1",
    "@sentry/tracing": "^6.4.1",
    "@ucast/core": "^1.10.1",
    "@ucast/sql": "^1.0.0-alpha.1",
    "ajv": "^8.6.1",
    "ajv-formats": "^2.1.1",
    "auto-changelog": "^2.3.0",
    "aws-sdk": "^2.645.0",
    "axios": "^0.24.0",
    "bull": "^3.22.6",
    "casl": "^1.1.0",
    "chance": "^1.1.3",
    "cli-table3": "^0.6.0",
    "cors": "^2.8.5",
    "crypto-random-string": "^3.2.0",
    "dotenv": "^9.0.2",
    "express": "^4.17.1",
    "express-basic-auth": "^1.2.0",
    "express-winston": "^4.1.0",
    "faker": "^5.5.3",
    "feathers-hooks-common": "^5.0.6",
    "feathers-knex": "^7.1.1",
    "feathers-objection": "^7.1.6",
    "feathers-redis-cache": "^1.2.1",
    "joi": "^17.4.0",
    "knex": "^0.95.6",
    "lodash": "^4.17.21",
    "mathjs": "^10.0.0",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.33",
    "money": "^0.2.0",
    "murmurhash-native": "^3.5.0",
    "objection": "^2.2.15",
    "objection-visibility": "^1.1.0",
    "open-exchange-rates": "^0.3.0",
    "parse-database-url": "^0.3.0",
    "passport-http-bearer": "^1.0.1",
    "paypal-rest-sdk": "^1.8.1",
    "pg": "^8.6.0",
    "prompt": "^1.1.0",
    "prompts": "^2.4.1",
    "redis-url": "^1.2.1",
    "sib-api-v3-sdk": "^8.2.0",
    "stripe": "^7.14.0",
    "uuid-by-string": "^3.0.2",
    "winston": "^3.3.3",
    "winston-aws-cloudwatch": "^3.0.0",
    "winston-syslog": "^2.4.4",
    "xstate": "^4.19.1"
  }
royaltm commented 2 years ago

There are probably outdated deps (node-pre-gyp) in this package. Should be no problem on node.js < v15 though.

overhub-edvin commented 2 years ago

There are probably outdated deps (node-pre-gyp) in this package. Should be no problem on node.js < v15 though.

It's really odd. I just tried installing node 14.17.1, nuking yarn.lock and node_modules and then running yarn and I got the same type of build error. Again, the module builds using npm i murmurhash-native --build-from-source on both version 14.17.1 and 16.13.1

It just seems to have problems installing when in combination with the other mods. Have you ever seen any such behavior?

overhub-edvin commented 2 years ago

I just forked this and replaced node-pre-gyp@0.17.x with @mapbox/node-pre-gyp@1.0.7, and then updated the require statement in index.js to import @mapbox/node-pre-gyp. I then pointed my project to my fork, and I'm able to get everything to install and work correctly on node@16.

I don't have time right now to test backwards compatibility with older node versions, but this does seem to be a solution in my specific case.

royaltm commented 2 years ago

Thanks for the solution, I'll look into that.