Sage 9.0.9 - when running "yarn" - node-sass - python2 not found

I’m trying to simply follow the install guide found here:

Windows 10, every dependency is the latest version as far as I know. I did all the dependency installs yesterday.

node -v
php -v
PHP 7.3.5 (cli) (built: May 1 2019 13:17:17) ( ZTS MSVC15 (Visual C++ 2017) x64 )
npm -v

After running the compose command, I see everything install correctly here:

Installing roots/sage (9.0.9)

  • Installing roots/sage (9.0.9): Loading from cache

Then when I try to run the yarn command, I see the error:

error node-sass: Command failed.
Command: node scripts/build.js
Directory: \node_modules\node-sass
gyp info using node-gyp@3.8.0
gyp info using node@12.18.0 | win32 | x64
gyp verb check python checking for Python executable “python2” in the PATH
gyp verb which failed Error: not found: python2

Do I really have to install python on my system? Why is this not listed as a dependency on the install guide for Sage 9?


1 Like

IIRC your problem is that node-sass wants Python to compile itself. You can switch to the version compiled from Dart Sass (which is the new “official” implementation and pure JavaScript) and avoid that error (and presumably the need for Python):

Thanks for your reply. I just tried everything with a completely fresh install of Windows 10 and got the same error on a different machine.

How exactly do you “switch to the version compiled from Dart Sass” ? I added dart-sass to my package.json file but not sure what the next steps would be. I get a “node-sass” not found when doing this.

Thank you.

Recently, i had a similar problem on macOS and I solved downgrading to node 8.

That worked for me, thanks!

I downloaded the 8.x files (from here) and replaced my local node files with them. I was able to run yarn after that.

glad for it.
You’re welcome

Hi @buchannon

I’ve just encoutered the same issue during install on my Windows 10 machine.
Node: 12.16.2
NPM: 6.14.4
PHP: 7.4.7

I was looking for an alternative solution because I didn’t feel like downgrading my node version or swapping node-sass in favour of dart-sass, when I came across this solution.

I did the following:

  1. Deleted yarn.lock file and the node_modules directory
  2. Updated package.json entry to the current version of node-sass: "node-sass": "~4.14.1"
  3. Built the project again using yarn && yarn build

Suddenly, the compilation process finished successfully.


This topic was automatically closed after 42 days. New replies are no longer allowed.