turbo: [WEB-966] [Turbopack] Libraries depending on node-gyp-build fail parsing

What version of Turbopack are you using?

latest alpha

What package manager are you using / does the bug impact?

pnpm, Yarn v1

What operating system are you using?

Linux

Describe the Bug

When using a package which depends on node-gyp-build (such as the supabase-js client), turbopack can’t compile the app.

It fails with the following output:

error - [resolve] [project-with-next]/node_modules/node-gyp-build/index.js  Error resolving commonjs request
  unable to resolve dynamic
  
  | It was not possible to find the requested file.
  | Parsed request as written in source code: dynamic
  | Path where resolving has started: [project-with-next]/node_modules/node-gyp-build/index.js
  | Type of request: commonjs request

when I run next dev --turbo --show-all I additionally get this info:

error - [resolve] node_modules/node-gyp-build/index.js
  Error resolving commonjs request
  unable to resolve dynamic

[parse]
  node_modules/node-gyp-build/index.js
    node_modules/node-gyp-build/index.js:22:9  lint TP1002 require(???*0*) is very dynamic
        18   
        19   module.exports = load
        20   
        21   function load (dir) {
        22 >   return runtimeRequire(load.path(dir))
        23   }
        24   
        25   load.path = function (dir) {
        26     dir = path.resolve(dir || '.')
    
    - *0* ???*1*(???*2*)
      ⚠️  call of unknown function
    - *1* (...) => (??? | ???)["path"]
      ⚠️  property on function
    - *2* arguments[0]
      ⚠️  cross function analyzing is not yet supported

Expected Behavior

Importing packages which depend on node-gyp-build should work.

To Reproduce

Checkout the repo below. It’s an exceedingly minimal Next 13 project. next dev works as intended. next dev --turbo will produce the aforementioned error.

Reproduction Repo

https://github.com/Escapado/next-turbo-bug

WEB-966

WEB-1137

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 16
  • Comments: 20 (1 by maintainers)

Most upvoted comments

Still happening on Next 14

Massive blocker here. Unable to use supabase inside components due to this weird error.

I’m using pnpm.

Module not found
It was not possible to find the requested file.
    Parsed request as written in source code: dynamic
    Path where resolving has started: [project]/node_modules/.pnpm/node-gyp-build@4.6.1/node_modules/node-gyp-build/node-gyp-build.js
    Type of request: commonjs request
    Import map: No import map entry
    


 ⨯ ModuleBuildError: error - node_modules/.pnpm/node-gyp-build@4.6.1/node_modules/node-gyp-build/node-gyp-build.js:22:9

+1 here with the Supabase client

This is a serious blocker

Kind of hilariously bad that @vercel/postgres@0.5.1 (Vercel’s own package) breaks Turbopack when using Next@14.0.2 with this error. Y’all really need to do some testing before releasing.

still not work in next 13.5

Any update on this? Still seeing the issue a year later!

This is finally fixed with Next 14.0.4! 🥳

Can confirm this is still an issue with the latest supabase library + nextJS 14.0.3.

same problem next 14.0.3

Yes, Next 14 have this problem