vercel: [now] nestjs error: cannot find module `@nodelib/fs.stat`

I’m trying to deploy nestjs server. Few days ago it worked fine, but now i get this error:


SyntaxError: Unexpected token (16:10)
09:39:17 PM | at Object.re.raise (evalmachine.<anonymous>:1:266416)
09:39:17 PM | at Object.z.unexpected (evalmachine.<anonymous>:1:222693)
09:39:17 PM | at Object.ee.parseIdent (evalmachine.<anonymous>:1:265599)
09:39:17 PM | at Object.parseIdent (evalmachine.<anonymous>:1:461728)
09:39:17 PM | at Object.parseIdent (evalmachine.<anonymous>:1:186548)
09:39:17 PM | at Object.ee.parsePropertyName (evalmachine.<anonymous>:1:261995)
09:39:17 PM | at Object.parsePropertyName (evalmachine.<anonymous>:1:4333)
09:39:17 PM | at Object.H.parseClassElement (evalmachine.<anonymous>:1:236905)
09:39:17 PM | at Object.parseClassElement (evalmachine.<anonymous>:1:459918)
09:39:17 PM | at Object.parseClassElement (evalmachine.<anonymous>:1:183081)
09:39:17 PM | Module build failed (from /tmp/ef2c4852ec461ae6/.build-utils/.builder/node_modules/@zeit/ncc/dist/ncc/loaders/relocate-loader.js):
09:39:17 PM | SyntaxError: Unexpected token (15:10)
09:39:17 PM | at Object.re.raise (evalmachine.<anonymous>:1:266416)
09:39:17 PM | at Object.z.unexpected (evalmachine.<anonymous>:1:222693)
09:39:17 PM | at Object.ee.parseIdent (evalmachine.<anonymous>:1:265599)
09:39:17 PM | at Object.parseIdent (evalmachine.<anonymous>:1:461728)
09:39:17 PM | at Object.parseIdent (evalmachine.<anonymous>:1:186548)
09:39:17 PM | at Object.ee.parsePropertyName (evalmachine.<anonymous>:1:261995)
09:39:17 PM | at Object.parsePropertyName (evalmachine.<anonymous>:1:4333)
09:39:17 PM | at Object.H.parseClassElement (evalmachine.<anonymous>:1:236905)
09:39:17 PM | at Object.parseClassElement (evalmachine.<anonymous>:1:459918)
09:39:17 PM | at Object.parseClassElement (evalmachine.<anonymous>:1:183081)
09:39:17 PM | at compiler.close.n (evalmachine.<anonymous>:3:1350338)
09:39:17 PM | at _promise0.then._result0 (eval at create (evalmachine.<anonymous>:1:349386), <anonymous>:13:1)
09:39:17 PM | at <anonymous>

now.json:

{
    "name": "super-cool-project-name",
    "builds": [
        { "src": "index.js", "use": "@now/node-server" }
    ],
    "routes": [
        {
            "headers": {
                "Access-Control-Allow-Origin": "*",
                "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
                "Access-Control-Allow-Headers": "X-Requested-With, Content-Type, Accept"
            },
            "src": "/.*",
            "dest": "/index.js"
        }
    ]
}

index.js:

require('ts-node')
require('tsconfig-paths/register');
require('./src/main');

any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 19 (5 by maintainers)

Most upvoted comments

This dependency is used in @nestjs/graphql

@styfle When will it be fixed?

I’m using graphql-tools for loading and merging .graphql files and I’m getting the same error on zeit now. even when I have changed @graphql-toolkit/file-loading as @elvenking said.

@cheel1337

I fixed it on my side:

I was using graphql-modules & graphql-toolkit packages together. Unfortunately there was a recent change in how graphql-toolkit is published on npmjs.com https://github.com/Urigo/graphql-modules/commit/eecfc5208f00387b2d6595da98b1510bc137be2b

So i basically started depending on prefixed packages and it works now !

‘graphql-toolkit’ -> ‘@graphql-toolkit/file-loading

I see.

The @nodelib/fs.stat error is likely from fast-glob and globby tracked here https://github.com/zeit/node-file-trace/issues/55

If you can replace that dependency with a different glob implementation, it should work.