Skip to content

gatsby-adapter-netlify went wrong installing the "sharp" module #39377

@torn4dom4n

Description

@torn4dom4n

Preliminary Checks

Description

gatsby-adapter-netlify cannot find module '../build/Release/sharp-linux-x64.node'

Reproduction Link

https://github.com/area44/gatsby-starter-emilia

Steps to Reproduce

  1. Clone gatsby-starter-emilia
  2. Deploy to Netlify
  3. Get the error

Expected Result

Deployment Success

Actual Result

Deployment fail with this log:

4:17:48 PM: info [gatsby-adapter-netlify] Found a Gatsby cache. We're about to go FAST. ⚡
error Error in "/opt/build/repo/node_modules/gatsby-transformer-sharp/gatsby-node":
4:17:48 PM: Something went wrong installing the "sharp" module
4:17:48 PM: Cannot find module '../build/Release/sharp-linux-x64.node'
4:17:48 PM: Require stack:
4:17:48 PM: - /opt/build/repo/node_modules/sharp/lib/sharp.js
4:17:48 PM: - /opt/build/repo/node_modules/sharp/lib/constructor.js
4:17:48 PM: - /opt/build/repo/node_modules/sharp/lib/index.js
4:17:48 PM: - /opt/build/repo/node_modules/gatsby-plugin-sharp/safe-sharp.js
4:17:48 PM: - /opt/build/repo/node_modules/gatsby-plugin-sharp/index.js
4:17:48 PM: - /opt/build/repo/node_modules/gatsby-transformer-sharp/customize-schema.js
4:17:48 PM: - /opt/build/repo/node_modules/gatsby-transformer-sharp/gatsby-node.js
4:17:48 PM: Possible solutions:
4:17:48 PM: - Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
4:17:48 PM: - Install for the current linux-x64 runtime: "npm install --platform=linux --arch=x64 sharp"
4:17:48 PM: - Consult the installation documentation: https://sharp.pixelplumbing.com/install
4:17:48 PM: 
4:17:48 PM: 
4:17:48 PM:   Error: Something went wrong installing the "sharp" module
4:17:48 PM:   Cannot find module '../build/Release/sharp-linux-x64.node'
4:17:48 PM:   Require stack:
4:17:48 PM:   - /opt/build/repo/node_modules/sharp/lib/sharp.js
4:17:48 PM:   - /opt/build/repo/node_modules/sharp/lib/constructor.js
4:17:48 PM:   - /opt/build/repo/node_modules/sharp/lib/index.js
4:17:48 PM:   - /opt/build/repo/node_modules/gatsby-plugin-sharp/safe-sharp.js
4:17:48 PM:   - /opt/build/repo/node_modules/gatsby-plugin-sharp/index.js
4:17:48 PM:   - /opt/build/repo/node_modules/gatsby-transformer-sharp/customize-schema.js
4:17:48 PM:   - /opt/build/repo/node_modules/gatsby-transformer-sharp/gatsby-node.js
4:17:48 PM:   Possible solutions:
4:17:48 PM:   - Install with verbose logging and look for errors: "npm install --ignore-scri  pts=false --foreground-scripts --verbose sharp"
4:17:48 PM:   - Install for the current linux-x64 runtime: "npm install --platform=linux --a  rch=x64 sharp"
4:17:48 PM:   - Consult the installation documentation: https://sharp.pixelplumbing.com/inst  all
4:17:48 PM:   
4:17:48 PM:   - sharp.js:37 Object.<anonymous>
4:17:48 PM:     [repo]/[sharp]/lib/sharp.js:37:9
4:17:48 PM:   
4:17:48 PM:   - loader:1761 Module._compile
4:17:48 PM:     node:internal/modules/cjs/loader:1761:14
4:17:48 PM:   
4:17:48 PM:   - loader:1893 Object..js
4:17:48 PM:     node:internal/modules/cjs/loader:1893:10
4:17:48 PM:   
4:17:48 PM:   - loader:1481 Module.load
4:17:48 PM:     node:internal/modules/cjs/loader:1481:32
4:17:48 PM:   
4:17:48 PM:   - loader:1300 Module._load
4:17:48 PM:     node:internal/modules/cjs/loader:1300:12
4:17:48 PM:   
4:17:48 PM:   - node:diagnostics_channel:328 TracingChannel.traceSync
4:17:48 PM:     node:diagnostics_channel:328:14
4:17:48 PM:   
4:17:48 PM:   - loader:245 wrapModuleLoad
4:17:48 PM:     node:internal/modules/cjs/loader:245:24
4:17:48 PM:   
4:17:48 PM:   - loader:1504 Module.require
4:17:48 PM:     node:internal/modules/cjs/loader:1504:12
4:17:48 PM:   
4:17:48 PM:   - helpers:152 require
4:17:48 PM:     node:internal/modules/helpers:152:16
4:17:48 PM:   
4:17:48 PM:   - constructor.js:11 Object.<anonymous>
4:17:48 PM:     [repo]/[sharp]/lib/constructor.js:11:1
4:17:48 PM:   
4:17:48 PM:   - loader:1761 Module._compile
4:17:48 PM:     node:internal/modules/cjs/loader:1761:14
4:17:48 PM:   
4:17:48 PM:   - loader:1893 Object..js
4:17:48 PM:     node:internal/modules/cjs/loader:1893:10
4:17:48 PM:   
4:17:48 PM:   - loader:1481 Module.load
4:17:48 PM:     node:internal/modules/cjs/loader:1481:32
4:17:48 PM:   
4:17:48 PM:   - loader:1300 Module._load
4:17:48 PM:     node:internal/modules/cjs/loader:1300:12
4:17:48 PM:   
4:17:48 PM:   - node:diagnostics_channel:328 TracingChannel.traceSync
4:17:48 PM:     node:diagnostics_channel:328:14
4:17:48 PM:   
4:17:48 PM:   - loader:245 wrapModuleLoad
4:17:48 PM:     node:internal/modules/cjs/loader:245:24
4:17:48 PM:   
4:17:48 PM: 
4:17:48 PM: not finished load plugins - 0.202s
4:17:48 PM: ​
4:17:48 PM: "build.command" failed                                        
4:17:48 PM: ────────────────────────────────────────────────────────────────
4:17:48 PM: ​
4:17:48 PM:   Error message
4:17:48 PM:   Command failed with exit code 1: gatsby build (https://ntl.fyi/exit-code-1)
4:17:48 PM: ​
4:17:48 PM:   Error location
4:17:48 PM:   In build.command from netlify.toml:
4:17:48 PM:   gatsby build
4:17:48 PM: ​
4:17:48 PM:   Resolved config
4:17:48 PM:   build:
4:17:48 PM:     command: gatsby build
4:17:48 PM:     commandOrigin: config
4:17:48 PM:     environment:
4:17:48 PM:       - REVIEW_ID
4:17:48 PM:     publish: /opt/build/repo/public
4:17:48 PM:     publishOrigin: config
4:17:48 PM:   plugins:
4:17:48 PM:     - inputs: {}
4:17:48 PM:       origin: ui
4:17:48 PM:       package: "@netlify/plugin-gatsby"
4:17:49 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:17:49 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:17:49 PM: Failing build: Failed to build site

Environment

https://app.netlify.com/projects/starter-emilia/deploys/691c396c9eaca9000892b234#L1-L51

Config Flags

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: triage neededIssue or pull request that need to be triaged and assigned to a reviewertype: bugAn issue or pull request relating to a bug in Gatsby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions