'Cannot find module 'sass' and 'MODULE_NOT_FOUND' in Mac os

I have a static pages and using Sass in the page and use gulp to run on the browser.(npm install). Earlier it was working fine on window os. Now I switched to Mac Os and getting error

Package.json file:

{
  "title": "Syne Admin",
  "name": "syne-admin",
  "scripts": {
    "start": "gulp watch"
  },
  "description": "Syne Admin Theme.",
  "keywords": [
    "css",
    "sass",
    "html",
    "responsive",
    "theme",
    "template",
    "admin",
    "app"
  ],
  "homepage": "https://github.com/ranjansingh009/ranjanTestSyne#readme",
  "bugs": {
    "url": "https://github.com/ranjansingh009/ranjanTestSyne/issues",
    "email": "[email protected]"
  },
  "author": "Syne Dashboard",
  "contributors": [
    "Ranjan Kumar Singh"
  ],
  "repository": {
    "type": "git",
    "url": "git+https://github.com/ranjansingh009/ranjanTestSyne.git"
  },
  "dependencies": {
    "@fortawesome/fontawesome-free": "5.15.1",
    "@ttskch/select2-bootstrap4-theme": "^1.5.2",
    "bootstrap": "4.5.3",
    "bootstrap-datepicker": "^1.9.0",
    "gulp": "4.0.2",
    "jquery": "3.5.1",
    "jquery.easing": "^1.4.1",
    "node-sass": "^7.0.1",
    "select2": "^4.1.0-rc.0"
  },
  "devDependencies": {
    "browser-sync": "2.26.13",
    "del": "6.0.0",
    "gulp": "4.0.2",
    "gulp-autoprefixer": "7.0.1",
    "gulp-clean-css": "4.3.0",
    "gulp-header": "2.0.9",
    "gulp-plumber": "^1.2.1",
    "gulp-rename": "2.0.0",
    "gulp-sass": "^5.1.0",
    "gulp-uglify": "3.0.2",
    "merge-stream": "2.0.0"
  },
  "version": "1.0.0",
  "main": "gulpfile.js",
  "license": "ISC"
}

I am getting the below error while run "npm install".

ranjansingh@Ranjans-MacBook-Air SyneApps % npm start

> [email protected] start
> gulp watch

Error: Cannot find module 'sass'
Require stack:
- /Users/ranjansingh/Desktop/MyComputer/Project/freelacing/syneWebsite/SyneApps/gulpfile.js
- /Users/ranjansingh/Desktop/MyComputer/Project/freelacing/syneWebsite/SyneApps/node_modules/gulp-cli/lib/shared/require-or-import.js
- /Users/ranjansingh/Desktop/MyComputer/Project/freelacing/syneWebsite/SyneApps/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js
- /Users/ranjansingh/Desktop/MyComputer/Project/freelacing/syneWebsite/SyneApps/node_modules/gulp-cli/index.js
- /Users/ranjansingh/Desktop/MyComputer/Project/freelacing/syneWebsite/SyneApps/node_modules/gulp/bin/gulp.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/ranjansingh/Desktop/MyComputer/Project/freelacing/syneWebsite/SyneApps/gulpfile.js:13:35)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/ranjansingh/Desktop/MyComputer/Project/freelacing/syneWebsite/SyneApps/gulpfile.js',
    '/Users/ranjansingh/Desktop/MyComputer/Project/freelacing/syneWebsite/SyneApps/node_modules/gulp-cli/lib/shared/require-or-import.js',
    '/Users/ranjansingh/Desktop/MyComputer/Project/freelacing/syneWebsite/SyneApps/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js',
    '/Users/ranjansingh/Desktop/MyComputer/Project/freelacing/syneWebsite/SyneApps/node_modules/gulp-cli/index.js',
    '/Users/ranjansingh/Desktop/MyComputer/Project/freelacing/syneWebsite/SyneApps/node_modules/gulp/bin/gulp.js'
  ]
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source