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: Comm…


This content originally appeared on DEV Community and was authored by Andrzej Krzywda

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 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp 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.0
gyp 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-sass
gyp ERR! node -v v16.0.0
gyp ERR! node-gyp -v v3.8.0
gyp 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 n
sudo n 14

and that's it.

A possible alternative:

brew remove node
brew install node@14

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


This content originally appeared on DEV Community and was authored by Andrzej Krzywda


Print Share Comment Cite Upload Translate Updates
APA

Andrzej Krzywda | Sciencx (2021-04-23T20:42:05+00:00) Fixing the node-sass problem in Rails – node downgrade helps. Retrieved from https://www.scien.cx/2021/04/23/fixing-the-node-sass-problem-in-rails-node-downgrade-helps/

MLA
" » Fixing the node-sass problem in Rails – node downgrade helps." Andrzej Krzywda | Sciencx - Friday April 23, 2021, https://www.scien.cx/2021/04/23/fixing-the-node-sass-problem-in-rails-node-downgrade-helps/
HARVARD
Andrzej Krzywda | Sciencx Friday April 23, 2021 » Fixing the node-sass problem in Rails – node downgrade helps., viewed ,<https://www.scien.cx/2021/04/23/fixing-the-node-sass-problem-in-rails-node-downgrade-helps/>
VANCOUVER
Andrzej Krzywda | Sciencx - » Fixing the node-sass problem in Rails – node downgrade helps. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/23/fixing-the-node-sass-problem-in-rails-node-downgrade-helps/
CHICAGO
" » Fixing the node-sass problem in Rails – node downgrade helps." Andrzej Krzywda | Sciencx - Accessed . https://www.scien.cx/2021/04/23/fixing-the-node-sass-problem-in-rails-node-downgrade-helps/
IEEE
" » Fixing the node-sass problem in Rails – node downgrade helps." Andrzej Krzywda | Sciencx [Online]. Available: https://www.scien.cx/2021/04/23/fixing-the-node-sass-problem-in-rails-node-downgrade-helps/. [Accessed: ]
rf:citation
» Fixing the node-sass problem in Rails – node downgrade helps | Andrzej Krzywda | Sciencx | https://www.scien.cx/2021/04/23/fixing-the-node-sass-problem-in-rails-node-downgrade-helps/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.