question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build Issues on Node.js 12.13.1

See original GitHub issue

Description: I’m running into build issues when adding the aerospike NPM package to a project because node-gyp fails. The build was working as expected when I used Node.js 10.17.0. Although this seems to be partly a Python issue (https://bugzilla.mozilla.org/show_bug.cgi?id=1453967), any ideas of how to solve it?

Aerospike Client: 3.13.0

Environment:

  • Ubuntu 18.04.3 LTS (Linux goldmine 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux)
  • Node.js 12.13.1
  • NVM 0.31.1
  • NPM 6.13.2
  • Python 3.6.9

Error Log:

flo@goldmine:~/dev/aerospike-project$ npm install aerospike --save

> aerospike@3.13.0 install /home/flo/dev/aerospike-project/node_modules/aerospike
> node-gyp rebuild

Traceback (most recent call last):
  File "/home/flo/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "/home/flo/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "/home/flo/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main
    return gyp_main(args)
  File "/home/flo/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 532, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "/home/flo/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2215, in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "/home/flo/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 794, in Write
    extra_mac_bundle_resources, part_of_all)
  File "/home/flo/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 978, in WriteActions
    part_of_all=part_of_all, command=name)
  File "/home/flo/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1724, in WriteDoCmd
    force = True)
  File "/home/flo/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1779, in WriteMakeRule
    cmddigest = hashlib.sha1(command if command else self.target).hexdigest()
TypeError: Unicode-objects must be encoded before hashing
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/flo/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.15.0-72-generic
gyp ERR! command "/home/flo/.nvm/versions/node/v12.13.1/bin/node" "/home/flo/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/flo/dev/aerospike-project/node_modules/aerospike
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/home/flo/dev/aerospike-project/node_modules/resolve-dir/node_modules/global-prefix/package.json'
npm WARN eslint-config-airbnb@18.0.1 requires a peer of eslint-plugin-react-hooks@^1.7.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aerospike@3.13.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the aerospike@3.13.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/flo/.npm/_logs/2019-12-06T09_46_48_792Z-debug.log

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
fschaefflercommented, Dec 6, 2019

It seems that the issue comes from breaking changes between Python 2 and 3. So the workaround is to use Python 2 when running an npm install aerospike. As Python 2 is getting it’s full end-of-life next month (2020-01), this is IMO something that needs attention.

0reactions
libtertycommented, Jun 16, 2020

I have encountered the same issue. However i solve it with following
ls /usr/local/Cellar/openssl which shows 1.0.2s then brew switch openssl 1.0.2s then python -c "import hashlib;m=hashlib.md5();print(m.hexdigest())"

Now node-gyp can successfully rebuild

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node v12.13.1 (LTS)
Notable changes. Experimental support for building Node.js with Python 3 is improved. ICU time zone data is updated to version 2019c.
Read more >
npm does not support Node.js v12.18.3
I found the work-around ! First you need to open your cmd line, and use " npm install -g npm@latest " you'll get...
Read more >
When nvm doesn't switch versions
Try to update node-gyp and file an Issue if it does not help: gyp ERR! <https://github.com/nodejs/node-gyp/issues> Build failed with error code: 7
Read more >
ELSA-2021-0744 - nodejs:14 security and bug fix update
backport patch for aarch64 debug build [1:8.5.0-2] - Disable debug builds on aarch64 due to https://github.com/nodejs/node/issues/15395
Read more >
How to install the previous version of node.js and npm
Node.js: It is a JavaScript runtime(server-side) built on V8 JavaScript engine of Google Chrome. It was developed in 2009 by Ryan Dhal.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found