question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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?

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
iivankincommented, Oct 4, 2019

This dependency is used in @nestjs/graphql

2reactions
iivankincommented, Oct 20, 2019

@styfle When will it be fixed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

0 - Stack Overflow
I encountered a error when using NestJS. The console shows 0 error first and then crahsed with the Error: Cannot find module './'...
Read more >
Cannot find module 'fs' Error in TypeScript | bobbyhadz
To solve the "Cannot find module fs or its corresponding type declarations" error, install the types for node by running the command npm...
Read more >
What does it take to support Node.js ESM? – The Guild
I have worked on all The Guild's libraries and graphql-js to support ESM. Here is how you can do it too.
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
In my case, I got it like this "Module not found: Error: Can't resolve 'react-icons/fa' in 'C:\Users\user\Desktop\Projects\Address Locator\ ...
Read more >
CCL1043-K21: Error when scaffolding the component
Command: snc ui-component project --name now-experience-dashboard --description "My First NXF ... Error: Cannot find module 'keytar'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found