node.jsreactjsgatsby

This type of error comes:- Cannot find module 'sharp'


Error: Cannot find module 'sharp'
  Require stack:
  - D:\Marketing\sbj-react\suburban\node_modules\gatsby-plugin-manifest\safe-sharp.js
  - D:\Marketing\sbj-react\suburban\node_modules\gatsby-plugin-manifest\gatsby-node.js
  - D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bootstrap\resolve-module-exports.js
  - D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bootstrap\load-plugins\validate.js
  - D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bootstrap\load-plugins\load.js
  - D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bootstrap\load-plugins\index.js
  - D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bootstrap\index.js
  - D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\commands\develop.js
  - D:\Marketing\sbj-react\suburban\node_modules\gatsby-cli\lib\create-cli.js
  - D:\Marketing\sbj-react\suburban\node_modules\gatsby-cli\lib\index.js
  - D:\Marketing\sbj-react\suburban\node_modules\gatsby\dist\bin\gatsby.js

1) npm install

2) npm also check with npm install --unsafe perm

3) npm start

4) npm install sharp

But still have same problem with me please resolve my question.

This is my package.json

{
  "name": "Ashish",
  "description": "Ashish Group Project",
  "version": "1.0.0",
  "author": "AshishBhangade <ashishbhangade@gmail.com>",
  "dependencies": {
    "axios": "^0.18.0",
    "babel-plugin-styled-components": "^1.10.0",
    "base-64": "^0.1.0",
    "bcryptjs": "^2.4.3",
    "bootstrap": "^4.1.3",
    "gatsby": "^2.0.53",
    "gatsby-background-image": "^0.9.11",
    "gatsby-graphiql-explorer": "^0.2.29",
    "gatsby-image": "^2.0.20",
    "gatsby-plugin-compression": "0.0.1",
    "gatsby-plugin-compression-v2": "^0.1.0",
    "gatsby-plugin-drift": "^1.0.0",
    "gatsby-plugin-facebook-analytics": "^2.0.2",
    "gatsby-plugin-facebook-pixel": "^1.0.3",
    "gatsby-plugin-facebook-sdk": "^1.0.6",
    "gatsby-plugin-google-analytics": "^2.0.9",
    "gatsby-plugin-google-gtag": "^1.0.8",
    "gatsby-plugin-google-tagmanager": "^2.0.7",
    "gatsby-plugin-hotjar": "^1.0.1",
    "gatsby-plugin-manifest": "^2.0.9",
    "gatsby-plugin-netlify": "^2.0.6",
    "gatsby-plugin-offline": "^2.0.21",
    "gatsby-plugin-react-helmet": "^3.0.2",
    "gatsby-plugin-robots-txt": "^1.4.0",
    "gatsby-plugin-sass": "^2.0.5",
    "gatsby-plugin-sentry": "^1.0.0",
    "gatsby-plugin-sharp": "^2.0.12",
    "gatsby-plugin-sitemap": "^2.0.4",
    "gatsby-plugin-styled-components": "^3.0.4",
    "gatsby-plugin-zopfli": "^1.0.2",
    "gatsby-source-apiserver": "^2.1.4",
    "gatsby-source-filesystem": "^2.0.8",
    "gatsby-transformer-sharp": "^2.1.8",
    "jquery": "^3.3.1",
    "logrocket": "^1.0.6",
    "logrocket-react": "^4.0.1",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.23",
    "node-sass": "^4.10.0",
    "perm": "^1.0.0",
    "react": "^16.6.3",
    "react-bootstrap": "^0.32.4",
    "react-bootstrap-time-picker": "^1.0.3",
    "react-datepicker": "^2.0.0",
    "react-device-detect": "^1.11.14",
    "react-dom": "^16.6.3",
    "react-ga": "^2.5.6",
    "react-helmet": "^5.2.0",
    "react-input-mask": "^2.0.4",
    "react-number-format": "^4.0.6",
    "react-otp-input": "^0.3.1",
    "react-phone-input-2": "^2.11.0",
    "react-places-autocomplete": "^7.2.1",
    "react-popper": "^1.3.2",
    "react-scroll": "^1.7.12",
    "react-select": "^3.0.8",
    "react-slick": "^0.23.2",
    "reactstrap": "^6.5.0",
    "slick-carousel": "^1.8.1",
    "socket.io-client": "^2.2.0",
    "styled-components": "^4.1.3",
    "universal-cookie": "^3.0.7"
  }
}

Solution

  • I was getting the same error on a mac and this fixed my issue

    Basically: