Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module '@nodelib/fs.stat' #2

Open
webhacking opened this issue Sep 18, 2019 · 3 comments
Open

Cannot find module '@nodelib/fs.stat' #2

webhacking opened this issue Sep 18, 2019 · 3 comments

Comments

@webhacking
Copy link

I'm using current repository.
When i'm trying to deploy the console is throwing this error "Cannot find module '@nodelib/fs.stat"

I'm not actually using this module on my app.

Is this NestJS issues ? Or zeit issues? @MarkPieszak

RequestId: ce806505-846c-401c-ad4f-0b0a069c9f60 Error: Runtime exited with error: exit status 1 Runtime.ExitError
--
Sep 18 2019 19:25:31:162 | 2019-09-18T10:25:31.076Z	undefined	ERROR	Cannot find module '@nodelib/fs.stat' 2019-09-18T10:25:31.078Z	undefined	ERROR	Did you forget to add it to "dependencies" in `package.json`? Duration: 991.27 ms  Billed Duration: 1000 ms  Memory Size: 3008 MB  Max Memory Used: 102 MB	 RequestId: fc3181f5-b9b5-4378-9dfe-027725d0fab0 Error: Runtime exited with error: exit status 1 Runtime.ExitError
Sep 18 2019 19:25:33:249 | 2019-09-18T10:25:33.146Z	undefined	ERROR	Cannot find module '@nodelib/fs.stat'
@webhacking
Copy link
Author

webhacking commented Sep 18, 2019

Here is detail of my errors.

Ready! Available at http://localhost:3000
> GET /
> Building @now/node:dist/src/main.js
Found `engines` in `package.json`, selecting range: 10.x
> Built @now/node:dist/src/main.js [23s]
Cannot find module '@nodelib/fs.stat'
Require stack:
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/node_modules/fast-glob/out/readers/stream.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/node_modules/fast-glob/out/providers/async.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/node_modules/fast-glob/out/index.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/node_modules/@nestjs/graphql/dist/graphql-types.loader.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/node_modules/@nestjs/graphql/dist/graphql-definitions.factory.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/node_modules/@nestjs/graphql/dist/index.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/node_modules/@nestjs/graphql/index.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/node_modules/nest-raven/raven.interceptor.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/node_modules/nest-raven/index.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/dist/src/authentication/authentication.module.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/dist/src/app.module.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/dist/src/main.js
- /private/var/folders/cc/q8bt7p252xb3mc9wm838_d8h0000gn/T/zeit-fun-0b39adde5e647/___now_launcher.js
- /Users/hax0r/Library/Caches/co.zeit.fun/runtimes/nodejs/bootstrap.js
Did you forget to add it to "dependencies" in `package.json`?

Also Other people seem to be having the same problem as me.

https://spectrum.chat/zeit/now/cannot-find-module-nodelib-fs-stat~02ab18c9-5e22-46fa-9cbe-5780c97cd142

Here is my package.json.

{
  "name": "x",
  "version": "0.0.0",
  "engines": {
    "node": "10.x"
  },
  "private": true,
  "maintainers": [
    "a@hax0r.info"
  ],
  "description": "description",
  "author": "영준",
  "scripts": {
    "document": "npx compodoc -p tsconfig.json -s",
    "build": "tsc -p tsconfig.json",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "ts-node -r tsconfig-paths/register src/main.ts",
    "start:dev": "nodemon",
    "start:debug": "nodemon --config nodemon-debug.json",
    "prestart:prod": "rimraf dist && npm run build",
    "start:prod": "node -r dist/src/main.js",
    "lint": "tslint -p tsconfig.json -c tslint.json",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config=e2e/jest-e2e.json --forceExit --detectOpenHandles"
  },
  "husky": {
    "hooks": {
      "pre-commit": "npm run format",
      "pre-push": "npm run test & npm run test:e2e"
    }
  },
  "dependencies": {
    "@nestjs/common": "6.7.1",
    "@nestjs/core": "6.7.1",
    "@nestjs/platform-express": "6.7.1",
    "@nestjs/jwt": "^6.1.1",
    "@nestjs/platform-fastify": "^6.7.1",
    "@nestjs/swagger": "^3.1.0",
    "@types/node": "^10.12.18",
    "aws-sdk": "^2.524.0",
    "bcryptjs": "^2.4.3",
    "class-transformer": "^0.2.3",
    "class-validator": "^0.10.0",
    "compression": "^1.7.4",
    "dotenv": "^8.1.0",
    "email-templates": "^6.0.2",
    "express": "^4.16.4",
    "express-rate-limit": "^5.0.0",
    "faker": "^4.1.0",
    "fastify-swagger": "^2.4.0",
    "helmet": "^3.21.0",
    "i18n": "^0.8.3",
    "jsonwebtoken": "^8.5.1",
    "moment": "^2.24.0",
    "mysql2": "^1.6.5",
    "nest-raven": "^5.0.0",
    "nodemailer": "^6.3.0",
    "pug": "^2.0.4",
    "qs": "^6.8.0",
    "reflect-metadata": "^0.1.13",
    "request-ip": "^2.1.3",
    "rimraf": "^2.6.2",
    "rxjs": "6.5.3",
    "sequelize": "^5.18.4",
    "sequelize-typescript": "^1.0.0",
    "slack-notify": "^0.1.7",
    "swagger-ui-express": "^4.0.2",
    "tslint-clean-code": "^0.2.9"
  },
  "devDependencies": {
    "@compodoc/compodoc": "^1.1.10",
    "@nestjs/testing": "^6.0.0",
    "@now/node": "^1.0.0",
    "@types/aws-sdk": "^2.7.0",
    "@types/bcryptjs": "^2.4.2",
    "@types/compression": "^1.0.1",
    "@types/dotenv": "^6.1.1",
    "@types/email-templates": "^6.0.0",
    "@types/express": "4.17.1",
    "@types/express-rate-limit": "^3.3.2",
    "@types/faker": "^4.1.5",
    "@types/helmet": "0.0.44",
    "@types/jest": "^23.3.13",
    "@types/jsonwebtoken": "^8.3.3",
    "@types/moment": "^2.13.0",
    "@types/nodemailer": "^6.2.1",
    "@types/qs": "^6.5.3",
    "@types/request-ip": "0.0.34",
    "@types/sequelize": "^4.28.4",
    "@types/supertest": "^2.0.8",
    "husky": "^3.0.5",
    "jest": "^23.6.0",
    "nodemon": "^1.18.9",
    "prettier": "^1.15.3",
    "supertest": "^3.4.2",
    "ts-jest": "24.1.0",
    "ts-node": "8.4.1",
    "tsconfig-paths": "^3.9.0",
    "tslint": "5.20.0",
    "typescript": "^3.6.3"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".spec.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

And here is my tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "baseUrl": "./",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "target": "es6",
    "sourceMap": true,
    "pretty": true,
    "outDir": "./dist",
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "forceConsistentCasingInFileNames": true,
    "allowSyntheticDefaultImports": true,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": true,
    "incremental": true
  },
  "exclude": ["node_modules"]
}

@MarkPieszak
Copy link
Member

Very strange! It looks like from researching around the issue might be with https://github.com/mrmlnc/fast-glob, but I can't find any issues/evidence there of it either.

It sounds like fs.stat or global aren't packaging their dependencies correctly somehow hmm

@MarkPieszak
Copy link
Member

I haven't used that library before, but I tried adding just the basic setup (and installation of it) to this repo itself and was able to run locally and npm run build && now deploy to Now - seemingly without any issues?

import * as fsStat from '@nodelib/fs.stat';

@Injectable()
export class AppService {
  constructor() {

    fsStat.stat('path', (error, stats) => { /* … */ });
  }

// ...

https://nestjs-now.mpieszak84.now.sh/

But it does sound like a downstream dependency issue regardless, as now is just taking everything we "build" and deploying the dist of it all. I wish it throw some better error information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants