Not able to clear cache and install fresh node modules again after running an npm dedupe command

I am using some third party libraries in my code. I ran into some error like “str.match is not a function”
In my local code i did these steps one by one in the order mentioned.

  1. npm dedupe
  2. rimraf package-lock.json
  3. rimraf node_modules
  4. npm install
  5. npm start

with these commands i was able to fix that error and everything is working fine. Now when i deploy my code changes in netlify i still see that str.match error in the console and its not working. how can i run these 5 commands on netlify in order to freshly install the node modules?

Please let me know if anyone has idea on this one. Basically i want to run those command in sequence on the netlify server where its getting deployed. So fresh node modules are installed on the server

Ok i fixed it by modifying the build scripts.

Thanks for the follow-up so we’d be aware you found a fix! Mind sharing more details, in case it could help someone else in the future?