Node Sass binding error when running npm run start

Hi everyone! I was following the guide here https://publichappinessmovement.com/t/topic/1216 to set up dev environment. I ran into this error when running npm run start:

Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 8.x
W20230327-21:18:51.506(-4)? (STDERR)
W20230327-21:18:51.506(-4)? (STDERR)     Found bindings for the following environments:
W20230327-21:18:51.506(-4)? (STDERR)       - OS X 64-bit with Node.js 18.x
W20230327-21:18:51.506(-4)? (STDERR)       - OS X 64-bit with Node.js 19.x
W20230327-21:18:51.506(-4)? (STDERR)       - OS X 64-bit with Node.js 14.x
W20230327-21:18:51.506(-4)? (STDERR)       - OS X 64-bit with Node.js 16.x
W20230327-21:18:51.506(-4)? (STDERR)
W20230327-21:18:51.506(-4)? (STDERR)     This usually happens because your environment has changed since running `npm install`.
W20230327-21:18:51.506(-4)? (STDERR)     Run `npm rebuild node-sass` to download the binding for your current environment.

I have tried meteor npm rebuild node-sass --force as suggested in the guide, but I got errors:

TypeError: Object.fromEntries is not a function
...

I noticed the node version showed up in the console with this error message was node@8.11.1, but when I run node -v, I got v14.21.3. How do I get these versions match? After some googling, I found that node 8 doesn’t support node-sass 8.0.0. So I believe this is at least part of the issue.
Thank you in advance!

2 Likes

Looking at this line, it seems you are running node 8. Do you have multiple versions of node running?

Please run the following command and share your output:

$ nvm list
1 Like

Hi! Thank you for replying. I pasted the output below. I don’t see any 8.x version installed. I am not sure why the error message says current environment: OS X 64-bit with Node.js 8.x. The node version I used is v14.21.3. Maybe I can try delete node and install again…

⇒  nvm list
->     v14.21.3
         system
default -> 14 (-> v14.21.3)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v14.21.3) (default)
stable -> 14.21 (-> v14.21.3) (default)
lts/* -> lts/hydrogen (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3
lts/gallium -> v16.19.1 (-> N/A)
lts/hydrogen -> v18.15.0 (-> N/A)
1 Like

I agree with you on this. For this type of issues, the first step is trying to set up the project without nodejs installed. Uninstall nodejs and try setting up the project again let’s see what happens.

I re-installed node, and I didn’t see the original error I’ve posted above anymore, but there were some other errors related to node-sass. After some googling, I found node-sass had deprecated, and it had moved to sass. So I did npm uninstall node-sass and npm install sass. Then meteor npm install ran successfully.

When running npm run start, I encountered errors with several Module build failed. It happened with sass-loader, which I had upgraded afterwards. Then it happened again with css-loader. I suspect they are somehow related to webpack? I wonder if it’s possible to upgrade webpack from 4 to 5? I will look into these errors more soon.

2 Likes

That’s awesome! I’m glad the error is gone.

Can you paste the error you currently have on your terminal?

I think we can upgrade to webpack 5. We have a task to upgrade the entire project. In that task, we will carry out the necessary upgrades :wink: . For now, let’s fix your errors :joy:

1 Like

I finally fixed all the errors! They were ALL due to versions being incompatible - especially sass, node-sass, sass-loader, webpack… I ended up using a website called https://www.npmpeer.dev/ to find compatible versions. I am new to node and npm stuff, so maybe there’s a better way to do this kind of thing?
And yes upgrading the entire project sounds great!

Now I got the rendering errors as I am running the master branch.

I’ve read comments here: Getting Started: Setting Up a Local Dev Environment - and related bug fixes - #48 by AndyatFocallocal
Should I switch to deploy-phm instead? Which branch are we actively working on? I am a little confused. I hope to pick up some task, do you have any suggestions where to start? Thank you!

2 Likes

That’s excellent problem solving @zhna123, well done!

It looks like the outdated packages are causing a real issue and we need to prioritize updating as most people would’ve dropped out rather than find a solution. Its great to know that you are patient and determined.

I’ll move this chat into the documentation section so it can help others who get stuck before we’re able to make those updates.

We normally make commits to both deploy-phm and master at the same time. Its not optimal and is being fixed then master will become our staging server. Deploy-phm is this live site and PRs to it go live around 11mins after being merged.

2 Likes

Thanks for helping @Marvelxy :slight_smile:

@zhna123 The best 1st task would be to introduce yourself here and include what skills you have or want to learn, then i’ll guide you to a good 1st task.

2 Likes

@zhna123 Do you have any questions about the project?