Build error when deploying to Netlify but not when running react-script locally

Cannot find module ‘sass’ even though sass has been installed and reinstalled several times. In fact, building the app works perfectly file locally as can be seen in the second screenshot.

Netlify site name:

Here is the terminal log from start to finish of the local react-scripts build log:

npm run build     
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

> calculator-app@0.1.0 build
> react-scripts build

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  42.87 KB  build\static\js\2.9cb84ac5.chunk.js
  23.86 KB  build\static\css\main.0d2269c8.chunk.css
  23.52 KB  build\static\css\2.e495dbae.chunk.css
  1.07 KB   build\static\js\main.e279ff1e.chunk.js
  778 B     build\static\js\runtime-main.4b6c8441.js

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  npm install -g serve
  serve -s build

Find out more about deployment here:

PS C:\Kod\movie-project\.netlify\calculator-app>
"dependencies": {
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "bootstrap": "^5.1.2",
    "eject": "^0.0.4",
    "react": "^17.0.2",
    "react-bootstrap": "^2.4.0",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "sass-loader": "^7.0.1",
    "web-vitals": "^1.1.2"

I don’t see sass listed as a dependency in the last piece of code that you’ve shared.

1 Like