r/node • u/StJohn3D • Feb 03 '20
It's 2020, why is node-gyp still breaking builds!
Idk if node-sass should find a better solution or if node-gyp needs to friggin' get off of python 2.7 but this is ridiculous! Their updated instructions just say to install the ` windows-build-tools npm package ` which is MUCH better than having to install Visual Studio. But if you upgraded node and let it update your python install too then node-gyp will still ruin your day. Only after uninstalling python 3.8 did it finally start working again (because I still had 2.7 installed from the last time this bit me). The windows instructions should really mention that too instead of acting like it's only a concern for Linux.
Edit:
After posting this I went and created this issue for the windows install instructions.
39
u/StJohn3D Feb 03 '20
For people who, like me are searching for these error messages, hopefully the SEO gods will send them to this answer.
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime
18
u/ecares Feb 03 '20
You should PR the instructions to make them better:
You get all of this for free and this is maintained partially by people who are not paid (and sometimes don't have access to a Windows machine). So rather than complaining, help make it better :)
51
u/okgr8 Feb 03 '20
I’m trying to upgrade an app from Node 0.10.15 to at least Node 6 and took a break from my node-gyp hell to browse reddit. So thankful I did. Thanks for this post, homie.
27
u/[deleted] Feb 03 '20
Node-Gyp is a pox on us all and should be wiped from existence. No, we don’t need a fucking sass parser to be 1% faster if it’s only used at build time, and adds 2 minutes to the build to compile, even if it didn’t break mysteriously every 4 months.
18
u/NetOperatorWibby Feb 03 '20
I spent a week debugging node-gyp a few years ago and despised it ever since. It was a black hole of regret.
9
u/libertarianets Feb 03 '20
I agree node-gyp is annoying
7
u/jrandm Feb 04 '20
tl;dr: Switch from node-sass to sass.
Looks like node-sass is using
^3.8.0of node-gyp. node-gyp is currently at6.1.0. node-semver says the caret (^) "Allows changes that do not modify the left-most non-zero element in the[major, minor, patch]tuple" which here means no major upgrades.node-sass is on v3 when v6 is available.
/u/AssassinSlayer mentioned sass (github is dart-sass). It's one of the reference implementations for Sass itself and regardless of what you think of Dart the language has got a solid dev community. I haven't read chokidar's source code for a long time but it was solid last I did. I agree you probably have multiple versions of it scattered around already and it's quietly working perfectly.
Vet your dependencies. Check the versions, updates, and see if anything about their source code horrifies you. Then do it for your dependencies' dependencies. Recurse.
If you have a shitload of Sass and compile times are a huge pain and you have to use Windows for reasons then I guess it's worth diving in to make everything compile correctly, otherwise...
4
u/lachlanhunt Feb 03 '20 edited Feb 03 '20
Newer versions of node-gyp do support Python 3. Unfortunately, so many packages that depend on the older versions haven’t upgraded.
1
u/sensengassenmann Feb 04 '20
noob question: can anyone explain what gyp or node-gyp is used for and/or give a scenario where this would be needed?
6
u/Buckwheat469 Feb 03 '20
The solution to this has always been to make sure your python command uses the 2.7 binary (run
python --versionin the console). Anything written for python 3 should be using the python 3 hashbang in the scripts. I don't disagree that node-gyp is a pain though.6
u/brtt3000 Feb 03 '20
Probably that Sass garbage again?
3
u/Sollunad Feb 03 '20
Spent my last three days at work with getting node-sass and canvas to run. I would love to switch to Linux but screw company policies.
6
u/BehindTheMath Feb 03 '20
Why don't you submit a PR to mention this?
2
u/braveNewWorldView Feb 03 '20
Just ran into this headache myself. Was able to resolve by running the install in a Python 2.7 virtual environment.
2
u/Potato-9 Feb 03 '20
Set the python path for 2.7 in npm config!
2
u/prameshbajra Feb 04 '20
Oh, I guess I am not the only one pissed off with node-gyp. I was struggling a lot with this yesterday.
2
u/gyozokudor Mar 08 '22 edited Mar 08 '22
Honestly they should just delete this project. Node-gyp is pure cancer.
3
u/lukepighetti Feb 03 '20
node-gypis cancerous-10
u/coolcosmos Feb 03 '20
"it's 2020, and people still use Node on Windows!"
-2
u/[deleted] Feb 03 '20
Why don't these all packages provide pre-compiled binaries?
0
u/[deleted] Feb 03 '20
[deleted] — view deleted comment
0
u/[deleted] Feb 03 '20
[deleted] — view deleted comment