Cannot upgrade node because of node-sass dependency


Topic: Cannot upgrade node because of node-sass dependency

jennifer.offner@kincentric.com pro premium priority asked 2 years ago

We are trying to get rid of all of our node-sass dependencies. This is required to move past node v14, which is end of life soon. We have successfully removed all dependencies requiring node-sass except for mdbreact.

The odd thing is that you don't have this in your list of dependencies. It is a dev dependency for you, which should not impact us. We bring in mdbreact via our package.json files:

"mdbreact": "git+https://oauth2<token>@git.mdbootstrap.com/mdb/react/re-pro.git#4.27.0"

Running under node v18, this fails because of the well-known node-sass-->lib-sass-->node-gyp deprecation issue.

We have tried to upgrade to React 17 and mdbreact 5.2 to see if the behavior changes, but we run into a wall there because of the issue in this thread: https://mdbootstrap.com/support/react/error-invalid-hook-call-896d7/

The workarounds provided are neither practical nor effective. They failed for us as they have for most who have posted this issue in the forums.

Do you have a way forward for us so we can upgrade our tooling to the latest LTS version of node?


Krzysztof Wilk staff answered 2 years ago

Hi!

I think the only solution, for now, is installing the package via the .tgz file instead of the npm (you can put this file in your main catalog and update the path in the package.json). Now you can edit dependencies of the mdbreact package directly in this archive and get rid of the node-sass plugin on your own.


jennifer.offner@kincentric.com pro premium priority answered 2 years ago

We have a stop-gap solution by pulling the latest solution (5.2), reverting the react version to 16.14, and building+packaging the library. This will have to be managed as a file dependency -- not ideal.

It looks to me like your move to v5 and react 17 was half-baked. Running npm ls react on the solution as it currently existing in gitlab returns the following:

# npm ls react                                                                                                    
mdbreact@5.2.0 C:\code\re-pro                                                                                     
`-- UNMET PEER DEPENDENCY react@17.0.1                                                                            

npm ERR! peer dep missing: react@^16.3.0, required by @material-ui/core@3.9.4                                     
npm ERR! peer dep missing: react@^16.0.0-0, required by enzyme-adapter-react-16@1.15.7                            
npm ERR! peer dep missing: react@0.14.x || ^15.0.0 || ^16.0.0, required by focus-trap-react@6.0.0                 
npm ERR! peer dep missing: react@^16.3.0, required by material-ui-pickers@2.2.4                                   
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0 || ^16.0.0-beta || ^16.0.0, required by react-chartjs-2@2.9.0 
npm ERR! peer dep missing: react@^16.x, required by react-image-lightbox@5.1.1                                    
npm ERR! peer dep missing: react@^15.5.4 || ^16.0.0, required by react-scroll@1.7.16                              

Running the tests results in

Test Suites: 45 failed, 87 passed, 132 total     
Tests:       257 failed, 1197 passed, 1454 total 

Many of these, of course, are because you failed to update enzyme. There is a fork available to support react 17. Some are broken for other reasons.

It seems clear to me that we are paying for unmaintained code. It's definitely unprofessional.


Krzysztof Wilk staff commented 2 years ago

Hi!

We will need some time to analyze this but we will treat this as our priority.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: MDB5 4.2.0
  • Device: All
  • Browser: All
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes
Tags