2

I am trying to install the following vue component via npm:

https://github.com/xwpongithub/vue-range-slider

I am installing it as:

npm install vue-range-component --save

However, I am getting the following errors in the console:

> [email protected] install /Users/jovan/Desktop/work/projects/topgraphs/node_modules/fsevents
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /Users/jovan/anaconda3/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:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
gyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:430:11)
gyp ERR! stack     at Socket.emit (events.js:200:13)
gyp ERR! stack     at Pipe.<anonymous> (net.js:586:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/Cellar/node/12.3.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jovan/Desktop/work/projects/topgraphs/node_modules/fsevents
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ [email protected]

So, apparently, the component was installed, but there is some sort of syntax error in Python? Searching the internet for a solution, I have only found some references to different Python versions, but there is no mention of a version in the entire error output above. I am using Python 3.7.

3
  • 1
    Can you install Python 2.7 for this one? Commented Mar 31, 2020 at 11:33
  • Well, I can, but it's strange that I would have to. I'll check what's going on with that package. Commented Mar 31, 2020 at 11:57
  • I think it's internally is using Python 2.7. Most Linux systems have it by default. Commented Apr 1, 2020 at 12:14

2 Answers 2

2

Yes, the Python code given is only valid with python versions before python3.

import sys; print "%s.%s.%s" % sys.version_info[:3];

In python3 the print statement was made a function, so the parenthesis can't be left out. The package should be updated to use:

import sys; print("%s.%s.%s" % sys.version_info[:3]);

.. instead.

Sign up to request clarification or add additional context in comments.

2 Comments

I see. So, I can't fix this myself, since I'm already using the latest version of that package? And also, the error is not related to the new package I installed, but the node-gyp package?
I can't say - node-gyp is a build tool used for building packages; the error might be because of the package it's building or it might be internal node-gyp itself. You can't fix this yourself, outside of making python2 the default python processor when you're installing the package (so that node-gyp uses python2 instead). I'd suggest making an upstream fix (i.e. a suggestion to the package maintainer where this error originates from) so that it works on both py2 and py3.
2

The syntax

print "string"

is not valid in Python 3+.

You have Python 3 but the library uses Python 2.7, so install that Python 2.7.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.