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

Deploying grunt-sass Results in Mangled Python Request #25636

Closed
jarfer opened this issue Jan 22, 2019 · 2 comments
Closed

Deploying grunt-sass Results in Mangled Python Request #25636

jarfer opened this issue Jan 22, 2019 · 2 comments
Labels
addons Issues and PRs related to native addons. invalid Issues and PRs that are invalid. wrong repo Issues that should be opened in another repository.

Comments

@jarfer
Copy link

jarfer commented Jan 22, 2019

Hi all,

There appears to be a fundamental issue in the script when doing "npm install grunt-sass" which runs some Python (presumably) to test which version of Python version running under Windows (10). Please note: you can do this with other command-line switches without needing to feed Python via the command line (which will bring it's own bag of woes, leading to this problem!)

I've never used Python before, but I can see at a glance this is invalid. Firstly, "print" must be encapsulated with brackets (if you intend to output variable(s)). But second, this would never have worked anyway, since the command itself contains quotes (") for the print statement: the console will parse this first meaning you would have at least added outer-quotes to ensure these parse first (I'm 99% sure this will also be true of BASH/TSH/TCSH etc)

Below is the corrected command you will be able (successfully) to run as part of this script

"c:\some\path\python.exe -c import sys; print ("%s.%s.%s" %sys.version_info[:3]);"

This is true as of the latest Python version (at the time of writing = 3.7.2) https://www.python.org/downloads/

See output below for how this currently runs:

PS C:\Users\me\some\path> npm install grunt-sass
..
..
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\path\to\python\python.exe -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "", 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:275:12)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at maybeClose (internal/child_process.js:925:16)
gyp ERR! stack at Socket.stream.socket.on (internal/child_process.js:346:11)
gyp ERR! stack at emitOne (events.js:116:13)
gyp ERR! stack at Socket.emit (events.js:211:7)
gyp ERR! stack at Pipe._handle.close [as _onclose] (net.js:557:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\some\path\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Some\Path\Documents\Project\node_modules\node-sass
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1

  • Version:
  • Platform:
  • Subsystem:
@bnoordhuis
Copy link
Member

Note that node-gyp is maintained over at nodejs/node-gyp and keep in mind it's incompatible with python 3 and documented as such; you need python 2.

this would never have worked anyway, since the command itself contains quotes (") for the print statement

The command is passed as a single argument to python, ref child_process.execFile().

I'm closing this out as there is no bug to address (python 3 compatibility is a long-term project for node-gyp) but thanks anyway for the report.

@bnoordhuis bnoordhuis added invalid Issues and PRs that are invalid. addons Issues and PRs related to native addons. wrong repo Issues that should be opened in another repository. labels Jan 22, 2019
@richardlau
Copy link
Member

FWIW nodejs/node-gyp#1534 fixed this (insofar as it logs an error from node-gyp rather than throwing a Python error) on node-gyp's master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addons Issues and PRs related to native addons. invalid Issues and PRs that are invalid. wrong repo Issues that should be opened in another repository.
Projects
None yet
Development

No branches or pull requests

3 participants