Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 23, 2021 08:42 pm GMT

Fixing the node-sass problem in Rails - node downgrade helps

Today I've had one of those irritating problems with Rails that I know one day I will have again. So, future me when you google it, here is the fix, you're welcome :)

The problem shows like this during rails new new_app

node_modules/node-sass: Command failed.

and

1 error generated.make: *** [Release/obj.target/binding/src/binding.o] Error 1gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2gyp ERR! stack     at ChildProcess.onExit (/Users/andrzej/apps/stimulus_infinite_scroll/node_modules/node-gyp/lib/build.js:262:23)gyp ERR! stack     at ChildProcess.emit (node:events:365:28)gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)gyp ERR! System Darwin 19.6.0gyp ERR! command "/usr/local/Cellar/node/16.0.0/bin/node" "/Users/andrzej/apps/stimulus_infinite_scroll/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="gyp ERR! cwd /Users/andrzej/apps/stimulus_infinite_scroll/node_modules/node-sassgyp ERR! node -v v16.0.0gyp ERR! node-gyp -v v3.8.0gyp ERR! not ok

As you can see, the node version used is 16.0.0. At the moment of writing this post, it's a relatively new version and not everything works fine with this.

The solution? Downgrade node.

In my case I did:

npm install -g nsudo n 14

and that's it.

A possible alternative:

brew remove nodebrew install node@14

If this helped you, let me know in the comments, so that I believe in value of such posts even more ;)


Original Link: https://dev.to/andrzejkrzywda/fixing-the-node-sass-problem-in-rails-node-downgrade-helps-16lh

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To