Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failed with Python error related to the print function. #2048

Closed
djalbat opened this issue Feb 16, 2020 · 2 comments
Closed

Build failed with Python error related to the print function. #2048

djalbat opened this issue Feb 16, 2020 · 2 comments

Comments

@djalbat
Copy link

djalbat commented Feb 16, 2020

  • Node version: 12.1.0
  • nvm version: 0.33.0
  • OS version: Darwin James 18.7.0 Darwin Kernel Version 18.7.0: Sat Oct 12 00:02:19 PDT 2019; root:xnu-4903.278.12~1/RELEASE_X86_64 x86_64
  • Compiler version:

Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Hi!

When I try to install a package via npm I get the following error:

james.smith:~/Public/formalmethods.co.uk$ i --save necessary@latest

> fsevents@1.2.11 install /Users/james.smith/Public/formalmethods.co.uk/node_modules/fsevents
> node-gyp rebuild

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /usr/local/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:304:12)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:1000:16)
gyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:405:11)
gyp ERR! stack     at Socket.emit (events.js:196:13)
gyp ERR! stack     at Pipe.<anonymous> (net.js:586:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/Users/james.smith/.nvm/versions/node/v12.1.0/bin/node" "/Users/james.smith/.nvm/versions/node/v12.1.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/james.smith/Public/formalmethods.co.uk/node_modules/fsevents
gyp ERR! node -v v12.1.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN formalmethods.co.uk No description
npm WARN formalmethods.co.uk No repository field.
npm WARN formalmethods.co.uk No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ necessary@3.6.3
updated 1 package and audited 6389 packages in 2.504s
found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

This has nothing to do with the particular package, it happens whatever I try to install via npm.

This has something to do with the Python, the errror is because there are no brackets around the print arguments, right? The Python version in the path is 3.7.4, so perhaps Python 2 should be installed in the path?

Any help would be appreciated. I have googled for this one, but can find nothing relevant.

Regards,
James

@cclauss
Copy link
Contributor

cclauss commented Feb 16, 2020

gyp ERR! node-gyp -v v3.8.0

This Python 3 syntax error is fixed in node-gyp v5.x and v6.x.

If you still have legacy Python on your machine then a quick fix would be:
NODE_GYP_FORCE_PYTHON=python2 node-gyp rebuild

@djalbat
Copy link
Author

djalbat commented Mar 3, 2020

Thanks and apologies for the tardy response. Funnily enough I now can't replicate this, but I have installed the latest node-gyp anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants