gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.22k stars 10.32k forks source link

Build gives webpack error 98001. Generated engines use disallowed import "node-gyp-build" #34912

Closed john-sc closed 2 years ago

john-sc commented 2 years ago

Preliminary Checks

Description

Cloned from github. gatsby new fg https://github.com/gatsbyjs/gatsby-starter-default gatsby develop works fine. gatsby build gives: success load gatsby config - 0.023s success load plugins - 0.641s ... success Execute page configs - 0.029s failed Validating Rendering Engines - 0.719s

ERROR #98001 WEBPACK

Built Rendering Engines failed validation failed validation.

Please open an issue with a reproduction at https://github.com/gatsbyjs/gatsby/issues/new for more help

Error: Generated engines use disallowed import "node-gyp-build". Only allowed imports are to Node.js builtin modules or engines internals.

Reproduction Link

https://github.com/gatsbyjs/gatsby-starter-default

Steps to Reproduce

  1. Clone the repository
  2. gatsby build

Expected Result

Expected the build to complete without error

Actual Result

Build webpack error 98001

Environment

System:
    OS: Windows 10 10.0.22000
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  Binaries:
    Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.9.6 - /usr/bin/python
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (98.0.1108.56)
  npmPackages:
    gatsby: ^4.8.0 => 4.8.0 
    gatsby-plugin-gatsby-cloud: ^4.8.0 => 4.8.0 
    gatsby-plugin-image: ^2.8.0 => 2.8.0 
    gatsby-plugin-manifest: ^4.8.0 => 4.8.0 
    gatsby-plugin-offline: ^5.8.0 => 5.8.0 
    gatsby-plugin-react-helmet: ^5.8.0 => 5.8.0 
    gatsby-plugin-sharp: ^4.8.0 => 4.8.0 
    gatsby-source-filesystem: ^4.8.0 => 4.8.0 
    gatsby-transformer-sharp: ^4.8.0 => 4.8.0 
  npmGlobalPackages:
    gatsby-cli: 4.8.0

Config Flags

It is unchanged from the repo

tyhopp commented 2 years ago

Hi @john-sc!

Sorry to hear you're running into an issue.

I wasn't able to reproduce this behavior with npx gatsby new default https://github.com/gatsbyjs/gatsby-starter-default, which should be equivalent since your global gatsby-cli is the latest version.

I'm on a Mac however, and I don't have a windows machine (virtual or otherwise) to try to reproduce on the same os. I'll check if someone with a windows machine can reproduce this, in the mean time can you verify this also happens with npx just to make sure there's no issue with your global gatsby-cli?

Thanks!

sukantatoptal commented 2 years ago

@tyhopp I am facing the same issue this only stared to happen from this morning ,

gatsby version "^4.0.0",

Windows System

image

OlgaBertash commented 2 years ago

I've faced the same error (Windows 11, Gatsby version: 4.8.0)

sukantatoptal commented 2 years ago

I've faced the same error (Windows 11, Gatsby version: 4.8.0)

Hi @OlgaBertash , were you able to solve this ?

msf97 commented 2 years ago

Same error ERROR #98001 WEBPACK

Built Rendering Engines failed validation failed validation.

Please open an issue with a reproduction at https://github.com/gatsbyjs/gatsby/issues/new for more help

Error: Generated engines use disallowed import "node-gyp-build". Only allowed imports are to Node.js builtin modules o r engines internals. failed Validating Rendering Engines - 1.344s

ERROR #98001 WEBPACK

Built Rendering Engines failed validation failed validation. node:internal/modules/cjs/loader:1005:19 Please open an issue with a reproduction at https://github.com/gatsbyjs/gatsby/issues/new for more help

not finished Running gatsby-plugin-sharp.IMAGE_PROCESSING jobs - 11.393s

LekoArts commented 2 years ago

Please post a minimal reproduction and/or give more information about your environment how we can reproduce this. Thanks!

msf97 commented 2 years ago

Please post a minimal reproduction and/or give more information about your environment how we can reproduce this. Thanks!

with this: gatsby new bug-repro https://github.com/gatsbyjs/gatsby-starter-minimal I did not receive an error. and build successful! when i use "gatsby new" I'm facing that error.

donaldboulton commented 2 years ago

Modules on Installation with yarn 3.2.0 shows node-gyp errors

have gotten errors on build with sharp once and imdb every time, this is with Gatsby 4.8.0, 4.7.2 does not give the installation or build errors. These errors do not happen using Gatsby develop.

` ➤ YN0032: │ sharp@npm:0.30.1: Implicit dependencies on node-gyp are discouraged

➤ YN0032: │ lmdb@npm:2.2.2: Implicit dependencies on node-gyp are discouraged

➤ YN0032: │ node-addon-api@npm:4.3.0: Implicit dependencies on node-gyp are discouraged

➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged

➤ YN0032: │ nan@npm:2.15.0: Implicit dependencies on node-gyp are discouraged`

I have noticed that You develop Gatsby on Apple computers because fs is used, which will not work on Windows. Test before production on Windows and try to figure out fs-extra.

Hamzah-syed commented 2 years ago

any update?

donaldboulton commented 2 years ago

Not fixed with clean install on 4.9.1

wardpeet commented 2 years ago

Can you try on gatsby@next?

karnbibek commented 2 years ago

The issue is because of the new version of gatsby and some incompatibility with other environments. As a temporary fix, I changed the version of gatsby in package.json to some older version "gatsby": "^3.9.0", which worked in my case.

KhabeesInsaan commented 2 years ago

I also got this issue when running gatsby build but not on gatsby develop. @karnbibek Can you please tell which other package version I have to change, these are the dependencies in my package.json: "@fontsource/cinzel": "^4.5.0", "@fontsource/eb-garamond": "^4.5.0", "@fontsource/encode-sans-expanded": "^4.5.0", "gatsby": "^4.9.0", "gatsby-plugin-gatsby-cloud": "^4.9.0", "gatsby-plugin-image": "^2.9.0", "gatsby-plugin-manifest": "^4.9.0", "gatsby-plugin-offline": "^5.9.0", "gatsby-plugin-react-helmet": "^5.9.0", "gatsby-plugin-sharp": "^4.9.0", "gatsby-source-filesystem": "^4.9.0", "gatsby-transformer-sharp": "^4.9.0", "prop-types": "^15.8.0", "react": "^17.0.1", "react-dom": "^17.0.1", "react-helmet": "^6.1.0", "react-icons": "^4.3.1", "react-scroll": "^1.8.6", "styled-components": "^5.3.3"

karnbibek commented 2 years ago

I also got this issue when running gatsby build but not on gatsby develop. @karnbibek Can you please tell which other package version I have to change, these are the dependencies in my package.json: "@fontsource/cinzel": "^4.5.0", "@fontsource/eb-garamond": "^4.5.0", "@fontsource/encode-sans-expanded": "^4.5.0", "gatsby": "^4.9.0", "gatsby-plugin-gatsby-cloud": "^4.9.0", "gatsby-plugin-image": "^2.9.0", "gatsby-plugin-manifest": "^4.9.0", "gatsby-plugin-offline": "^5.9.0", "gatsby-plugin-react-helmet": "^5.9.0", "gatsby-plugin-sharp": "^4.9.0", "gatsby-source-filesystem": "^4.9.0", "gatsby-transformer-sharp": "^4.9.0", "prop-types": "^15.8.0", "react": "^17.0.1", "react-dom": "^17.0.1", "react-helmet": "^6.1.0", "react-icons": "^4.3.1", "react-scroll": "^1.8.6", "styled-components": "^5.3.3"

Yes develop was working for me too. and I can see the "gatsby": "^4.9.0" which you can change to some older version and if any other issue comes changes other package version accordingly. (P.S. This is not the permanent fix)

donaldboulton commented 2 years ago

This is a gatsby-plugin-sharp error, on Linux it says the below

Error: Something went wrong installing the "sharp" module Cannot find module '../build/Release/sharp-linux-x64.node' Require stack:

I have had gatsby-image and now gatsby-plugin-image errors so many times since v 2, I am tired of this non-sense and am going to next which keeps it plugins stable and tests production installations and build on different platforms. Which obviously Gatsby does not, its almost like you are trying to break things. Which puts me and your other users through hell. Most of your packages have outdated modules of which some have been outdated for 5 to 6 years and there are alternatives other npm modules to be used. Go through all plugins you have built and update them or you will keep seeing stupid errors with Gatsby and destroy your customer base. I do not really find any new posts lately on Gatsby anything, all the best programmers in the last year are going to rust or next. Even a lot of the people who build and maintain Gatsby there personal websites are not Gatsby.

P.S. If I send a new commit to Github - Nelify with the package-lock.json or yarn.lock, I get the above build error. If I send no lock files it builds, tell y'all anything.

KhabeesInsaan commented 2 years ago

@karnbibek Thanks

KhabeesInsaan commented 2 years ago

For anybody still looking for a quick fix, I just used a previous version of the files (an older project, Oct 21), deleted the public, .cache and node_modules folders, ran npm, gatsby develop and gatsby build and it worked. For reference this is the package.json: "dependencies": { "@fontsource/cinzel": "^4.5.0", "@fontsource/eb-garamond": "^4.5.0", "@fontsource/encode-sans-expanded": "^4.5.3", "babel-plugin-styled-components": "^1.13.3", "gatsby": "^4.0.0", "gatsby-plugin-anchor-links": "^1.2.1", "gatsby-plugin-gatsby-cloud": "^4.0.0", "gatsby-plugin-image": "^2.0.0", "gatsby-plugin-manifest": "^4.0.0", "gatsby-plugin-offline": "^5.0.0", "gatsby-plugin-react-helmet": "^5.0.0", "gatsby-plugin-sharp": "^4.0.0", "gatsby-plugin-styled-components": "^5.0.0", "gatsby-source-filesystem": "^4.0.0", "gatsby-transformer-sharp": "^4.0.0", "prop-types": "^15.7.2", "react": "^17.0.1", "react-dom": "^17.0.1", "react-helmet": "^6.1.0", "react-icons": "^4.3.1", "react-scroll": "^1.8.6", "styled-components": "^5.3.3" }, "devDependencies": { "prettier": "^2.4.1" }, "keywords": [ "gatsby" ], "license": "0BSD", "scripts": { "build": "gatsby build", "develop": "gatsby develop", "format": "prettier --write \"*/.{js,jsx,ts,tsx,json,md}\"", "start": "gatsby develop", "serve": "gatsby serve", "clean": "gatsby clean", "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1" }, "repository": { "type": "git", "url": "https://github.com/gatsbyjs/gatsby-starter-default" }, "bugs": { "url": "https://github.com/gatsbyjs/gatsby/issues" } }

LekoArts commented 2 years ago

Again, we need a minimal reproduction with clear instructions on what version and system to use. Otherwise we can't help. I've minimized comments that showed some package.json as it's not relevant to this issue. Also, it doesn't help to make false claims about how we write or test code, our CI runs on Windows and we have people using it successfully on Windows. We want to help but y'all need to give us more information. Thanks!

KhabeesInsaan commented 2 years ago

@LekoArts Try using the git default starter, I did so and and it gave the same error.

wardpeet commented 2 years ago

It should be fixed, can you make sure all dependencies are up to date? I'm going to close it for now but feel free to re-open.

muscaiu commented 2 years ago

@wardpeet it's not fixed. I have the same issue: https://github.com/gatsbyjs/gatsby/issues/36042

It happens on npm run build on every environment.

Screenshot 2022-07-06 at 15 09 52
uuykay commented 2 years ago

Chiming in to say it is happening to me as well. There's nothing in the logs that really hint at what's going wrong.

image

Some of my dependencies and versions:

    "gatsby": "^4.8.1",
    "gatsby-image": "^3.11.0",
    "gatsby-plugin-alias-imports": "^1.0.5",
    "gatsby-plugin-gtag": "^1.0.13",
    "gatsby-plugin-manifest": "^4.8.1",
    "gatsby-plugin-offline": "^5.8.1",
    "gatsby-plugin-react-helmet": "^5.8.0",
    "gatsby-plugin-robots-txt": "^1.7.0",
    "gatsby-plugin-sass": "^5.8.0",
    "gatsby-plugin-sharp": "^4.8.1",
    "gatsby-plugin-sitemap": "^5.8.0",
    "gatsby-plugin-typescript": "^4.8.1",
    "gatsby-source-filesystem": "^4.13.0",
    "gatsby-transformer-json": "^4.13.0",
    "gatsby-transformer-sharp": "^4.8.0",
donaldboulton commented 2 years ago

Gatsby 4.8.1 had issues update to the latest modules. Gtag was giving me issues use Scripts API to use Google tags or partytown API

uuykay commented 2 years ago

Following up to say that I fixed it by updating my dependencies, this is my dependency list now:

    "gatsby": "^4.20.0",
    "gatsby-image": "^3.11.0",
    "gatsby-plugin-alias-imports": "^1.0.5",
    "gatsby-plugin-gtag": "^1.0.13",
    "gatsby-plugin-manifest": "^4.20.0",
    "gatsby-plugin-offline": "^5.20.0",
    "gatsby-plugin-react-helmet": "^5.20.0",
    "gatsby-plugin-robots-txt": "^1.7.1",
    "gatsby-plugin-sass": "^5.20.0",
    "gatsby-plugin-sharp": "^4.20.0",
    "gatsby-plugin-sitemap": "^5.20.0",
    "gatsby-plugin-typescript": "^4.20.0",
    "gatsby-source-filesystem": "^4.20.0",
    "gatsby-transformer-json": "^4.20.0",
    "gatsby-transformer-sharp": "^4.20.0",
joernroeder commented 2 years ago

I'm seeing the same but with canvas. Are there any tips on how I can debug this?

Error: Generated engines use disallowed import "canvas". Only allowed imports are to Node.js builtin modules or engines internals.

hesta-inrsaurabh commented 1 year ago

I am facing this issue.

image

It's working fine on develop server. Deployed to live linux server. Not getting the above error.

No more info is shown.Any suggestion where to look for more info on error

hesta-inrsaurabh commented 1 year ago

I am facing this issue.

image

It's working fine on develop server. Deployed to live linux server. Not getting the above error.

No more info is shown.Any suggestion where to look for more info on error

In development mode everything is working fine.

Only production build is failing.

leandrocunha commented 11 months ago

I am facing this issue. image It's working fine on develop server. Deployed to live linux server. Not getting the above error. No more info is shown.Any suggestion where to look for more info on error

In development mode everything is working fine.

Only production build is failing.

I've got the same, did you solve that @hesta-inrsaurabh ?

insaurabh commented 3 months ago

I am facing this issue. image It's working fine on develop server. Deployed to live linux server. Not getting the above error. No more info is shown.Any suggestion where to look for more info on error

In development mode everything is working fine. Only production build is failing.

I've got the same, did you solve that @hesta-inrsaurabh ?

It was fixed when I downgraded the version, now after some time even with those versions it is crashing again.

Seems like I am stuck with gatsby and there issues.

uuykay commented 3 months ago

My advice is to get off Gatsby altogether if it's not too hate. My recommendation is Astro

On Mon, 10 June 2024, 11:25 pm Saurabh Ranjan, @.***> wrote:

I am facing this issue. [image: image] https://user-images.githubusercontent.com/136438094/256564449-78f8e778-67ab-4792-a61d-da6d1a3163fc.png It's working fine on develop server. Deployed to live linux server. Not getting the above error. No more info is shown.Any suggestion where to look for more info on error

In development mode everything is working fine. Only production build is failing.

I've got the same, did you solve that @hesta-inrsaurabh https://github.com/hesta-inrsaurabh ?

It was fixed when I downgraded the version, now after some time even with those versions it is crashing again.

Seems like I am stuck with gatsby and there issues.

— Reply to this email directly, view it on GitHub https://github.com/gatsbyjs/gatsby/issues/34912#issuecomment-2158376924, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHXBRSYLADRGT2US3I7PLSTZGWSMBAVCNFSM5PDTSFA2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJVHAZTONRZGI2A . You are receiving this because you commented.Message ID: @.***>

donaldboulton commented 3 months ago

Been using Gatsby for years on netlify work's perfect. my repo code might help at GitHub as donaldboulton.

On Mon, Jun 10, 2024, 5:17 PM Will @.***> wrote:

My advice is to get off Gatsby altogether if it's not too hate. My recommendation is Astro

On Mon, 10 June 2024, 11:25 pm Saurabh Ranjan, @.***> wrote:

I am facing this issue. [image: image] < https://user-images.githubusercontent.com/136438094/256564449-78f8e778-67ab-4792-a61d-da6d1a3163fc.png>

It's working fine on develop server. Deployed to live linux server. Not getting the above error. No more info is shown.Any suggestion where to look for more info on error

In development mode everything is working fine. Only production build is failing.

I've got the same, did you solve that @hesta-inrsaurabh https://github.com/hesta-inrsaurabh ?

It was fixed when I downgraded the version, now after some time even with those versions it is crashing again.

Seems like I am stuck with gatsby and there issues.

— Reply to this email directly, view it on GitHub https://github.com/gatsbyjs/gatsby/issues/34912#issuecomment-2158376924,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AHXBRSYLADRGT2US3I7PLSTZGWSMBAVCNFSM5PDTSFA2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJVHAZTONRZGI2A>

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/gatsbyjs/gatsby/issues/34912#issuecomment-2159401615, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSP5ZZV367IGQDF5HT3Q7TZGYQY3AVCNFSM5PDTSFA2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJVHE2DAMJWGE2Q . You are receiving this because you commented.Message ID: @.***>

insaurabh commented 3 months ago

I am debugging to fix the issue, once found I will share for sure.