Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

node-sass won't compile on Python 3 systems (e.g. EL8) due to node-gyp dependency lock #2877

Closed
ehelms opened this issue Mar 25, 2020 · 7 comments · Fixed by #2981
Closed

Comments

@ehelms
Copy link

ehelms commented Mar 25, 2020

The current version of node-sass is locked to the 3.8.0 stream of node-gyp. This version of node-gyp does not support Python 3 only environments such as Enterprise Linux 8.

This support was added to node-gyp starting at version 5.0.0. See:

nodejs/node-gyp#1582

Example compilation output:

gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/usr/lib/node_modules/node-gyp/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/lib/node_modules/node-gyp/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/lib/node_modules/node-gyp/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/lib/node_modules/node-gyp/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/lib/node_modules/node-gyp/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/lib/node_modules/node-gyp/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21)
  • NPM version (npm -v):
  • Node version (node -v):
  • Node Process (node -p process.versions):
  • Node Platform (node -p process.platform):
  • Node architecture (node -p process.arch):
  • node-sass version (node -p "require('node-sass').info"):
  • npm node-sass versions (npm ls node-sass):
@PolyPik
Copy link

PolyPik commented Mar 25, 2020

This fix is available in the v5 branch.

@saper saper added this to the 5.0 milestone Mar 30, 2020
@himdel
Copy link

himdel commented Apr 24, 2020

Indeed, fixed in 15886f0, now we just need a release :)

@gtmills
Copy link

gtmills commented Apr 28, 2020

We hit this on OpenBMC when trying to move up our meta-oe layer, which drops support for Python 2 and is Python 3 only. Any update of when a release with this fix will happen? I see this fix is in the v5 branch, would you consider pulling this fix into a version 4 release?

Thank you!
Gunnar

geissonator pushed a commit to openbmc/phosphor-webui that referenced this issue Apr 30, 2020
The version of node-gyp, ^3.8.0, used by node-sass does not support
Python 3 only environments.

Starting with node-gyp 5.0.0, support for Python 3 only was added.

Added node-gyp 6.1.0 to package.json and edited the node-sass
"requires" in package-lock.json to force node-sass to use this
version.

This problem can be seen if building an image or the webui
recipe with the meta-oe and poky subtree bumps:
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/31299
https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/31297

This poky refresh deprecates python2. From the mailing list:
https://lists.ozlabs.org/pipermail/openbmc/2020-February/020421.html

node-sass knows of this issue and has a fix, same fix as this,
move node-gyp to 6.1.0, but that fix isn't in a release yet.
Asked for a timeline of when a release with this fix will
happen. This change can be removed after moving to a
version of node-sass with this fix.
sass/node-sass#2877

Considered using https://www.npmjs.com/package/npm-force-resolutions
but required more packages and wasn't simple to make work.

Modifying package-lock.json manually is not recommended but
in this case until fixed upstream, not a better solution.

Tested: Built for a Witherspoon and no regression.
        Was able to build the GUI with change and 31299 / 31297.
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Change-Id: I514395ca0ae2fda6d46cb7a2a3e70cc5b92be58d
@Zekfad
Copy link

Zekfad commented Jun 16, 2020

There's a workaround using yarn until v5 is released:

	"resolutions": {
		"**/node-gyp": "^7.0.0"
	}

@himdel
Copy link

himdel commented Jun 16, 2020

There were only 5 commits to the v5 branch this year.

I would suggest that node-sass is truly dead, and Dart sass (npm:sass) is the new official sass implementation (which does not depend on node-gyp or python2).

@ext
Copy link

ext commented Jun 23, 2020

Run into this as well as part of python2.7 being dropped from our systems. Does the master-branch not build with later versions or why can it not be bumped there as well?

This effectively kills node-sass package until either v5 is released or node-gyp is bumped.

@dospunk
Copy link

dospunk commented Sep 26, 2020

also having this issue. It's really frustrating to have to install a deprecated language to use this when the version could just be bumped.

HoldYourWaffle added a commit to HoldYourWaffle/suspending-portal-vue that referenced this issue May 13, 2021
Avoids having to install Python 2: sass/node-sass#2877

Set sass-loader to 10.x instead of 11.x because it's incompatible with Vue 2: https://stackoverflow.com/a/66087132/10434371
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants