Install Error node-sass

Been running Sylius a while (upgraded from 1.8 through to 1.10) and wanted to try out 1.11 in a clean install.

Unfortunately I get a node build error on the yarn install step with node-sass failing.

Running Node 17.7.1, npm 8.5.5, Yarn 1.22.17 on Arch Linux.

Updating to gulp-sass 5.1 fixes the build error but now the yarn run gulp step won’t work.

Gulp-sass 5 requires explicit setting of the sass compiler. I have added the sass module (dart sass compiler) however I can’t get the gulpfile to accept the new parameters (see below for details from gulp-sass module documentation):

gulp-sass must be imported into your gulpfile, where you provide it the compiler of your choice. To use gulp-sass in a CommonJS module (which is most Node.js environments), do something like this:
const sass = require(‘gulp-sass’)(require(‘sass’));

To use gulp-sass in an ECMAScript module (which is supported in newer Node.js 14 and later), do something like this:

import dartSass from ‘sass’;
import gulpSass from ‘gulp-sass’;
const sass = gulpSass(dartSass);

None of these work in the project gulpfile.babel.js file. I notice that this file imports other gulpfile.babel.js files from the Sylius bundle directories. Do these need to be updated to use the newer gulp version?

Quick update:

I edited the Sylius AdminBundle and ShopBundle gulpfile.babel.js files to use the above changes and now the step works fine. So far everything seems to be running correctly.

Is there any reason why we can’t update the project to this newer version of gulp-sass and use the dart sass compiler (sass node module)? If there are no issues with compatibility I would recommend updating this to avoid others hitting this issue with newer node versions.

sudo yarn install fails with
➤ YN0009: │ node-sass@npm:4.14.1 couldn’t be built successfully (exit code 1, logs can be found here: /tmp/xfs-16ea10f2/build.log)
➤ YN0000: └ Completed in 1m 21s

the end of /tmp/xfs-16ea10f2/build.log=

gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/onyx/htdocs/sites/myproject/sylius/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (node:events:526:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 5.17.1-zen1-1-zen
gyp ERR! command “/usr/local/bin/node” “/home/onyx/htdocs/sites/myproject/sylius/node_modules/node-gyp/bin/node-gyp.js” “rebuild” “–verbose” “–libsass_ext=” “–libsass_cflags=” “–libsass_ldflags=” “–libsass_library=”
gyp ERR! cwd /home/onyx/htdocs/sites/myproject/sylius/node_modules/node-sass
gyp ERR! node -v v16.14.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1

On Archlinux 64 bit, current.
Following your advice:

npm install sass gulp-sass --save-dev


YN0000: └ Completed in 0s 720ms
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 0s 748ms
➤ YN0000: Done with warnings in 8s 217ms
[onyx@onyx-pc sylius]$ sudo yarn build
Usage Error: Couldn’t find a script named “build”.

$ yarn run [–inspect] [–inspect-brk] [-T,–top-level] [-B,–binaries-only] …

any idea what happened to build?

yarn build works fine for me (after modifying the vendor gulp files as I mentioned) so not sure sorry.

Any reason you are using sudo to run yarn?

I tried without sudo also, and still no good.
Suspecting the bleeding edge nature of Arch is the issue, and I probably need to spin up a VM of Debian in order to build it in there!

Arch shouldn’t be a problem (that’s what I’m running).

I think this project definitely needs to be updated for the latest node though. Obviously older versions are what they are, but the newest build of Sylius should try to run on the most up to date platform where possible (i.e. when dependencies are running on it).

1 Like

I gave up in the end. Having to change OSes just to install a tool for testing? Not worth the effort. I’ve found Backdrop CMS with Ubercart 3 to be sweet.

There’s a lot I like in Sylius, but I agree it doesn’t give much confidence having to downgrade tools and mess around to get it going. I’m definitely going to hold off upgrading until things seem more flexible (and will look at alternatives in the meantime).