Errors on running npm install in subtheme on Node 16+

Created on 20 January 2022, almost 3 years ago
Updated 5 November 2024, 16 days ago

Problem/Motivation

I see errors when running npm install on the generated subtheme. From the error, it seems that this is specific to the M1 (Apple Silicon) machines. As far as I can tell, the error is to do with node-sass and I have seen this happen before on M1 machines.

Steps to reproduce

On a M1 machine, follow the instructions to download the theme (^5.0) and run the create_subtheme.sh script. In the generated theme, run npm install. Eventually, the installation fails with a long sequence of error messages. Here is a snippet.

npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/libsass/src/ast.cpp:2:
npm ERR! ../src/libsass/src/ast.hpp:1614:25: warning: loop variable 'numerator' creates a copy from type 'const std::string' [-Wrange-loop-construct]
npm ERR!         for (const auto numerator : numerators)
npm ERR!                         ^
npm ERR! ../src/libsass/src/ast.hpp:1614:14: note: use reference type 'const std::string &' to prevent copying
npm ERR!         for (const auto numerator : numerators)
npm ERR!              ^~~~~~~~~~~~~~~~~~~~~~
npm ERR!                         &
npm ERR! ../src/libsass/src/ast.hpp:1616:25: warning: loop variable 'denominator' creates a copy from type 'const std::string' [-Wrange-loop-construct]
npm ERR!         for (const auto denominator : denominators)
npm ERR!                         ^
npm ERR! ../src/libsass/src/ast.hpp:1616:14: note: use reference type 'const std::string &' to prevent copying
npm ERR!         for (const auto denominator : denominators)
npm ERR!              ^~~~~~~~~~~~~~~~~~~~~~~~
npm ERR!                         &
npm ERR! 2 warnings generated.

This repeats several times for different file names where this file gets included.

Proposed resolution

Use the updated release of gulp-sass with the supported release of sass package.

Remaining tasks

Write a patch

User interface changes

None

API changes

We would also need to change gulpfile.js to use the updated gulp-sass package.

Data model changes

🐛 Bug report
Status

Fixed

Version

5.0

Component

Code

Created by

🇨🇦Canada hussainweb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany vistree

    Hi, I try to get gulp running on a Mac M3. I tried the old approach using patch from #2. But I can't get it to work.
    Can anyone give a quick step by step on how to make gulp work on a Mac with M3 processor?
    NPM version?
    NODE version?
    Python version?
    ...

    Thank you so much!

Production build 0.71.5 2024