nest: ESTree breaking build
Bug Report
Current behavior
Triggering ‘npm run build’ exits with a error from estree, originating from ESLint
node_modules/@types/eslint/index.d.ts:260:41 - error TS2724: '"/home/politik/projects/nestjs-meta-admin/node_modules/@types/estree/index"' has no exported member named 'ChainExpression'. Did you mean 'ThisExpression'?
260 ChainExpression?: (node: ESTree.ChainExpression & NodeParentExtension) => void;
~~~~~~~~~~~~~~~
node_modules/@types/eslint/index.d.ts:283:42 - error TS2694: Namespace '"/home/politik/projects/nestjs-meta-admin/node_modules/@types/estree/index"' has no exported member 'ImportExpression'.
283 ImportExpression?: (node: ESTree.ImportExpression & NodeParentExtension) => void;
Input Code
{
"name": "nestjs-meta-admin",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:watch": "nodemon --config nodemon.json",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"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 ./test/jest-e2e.json",
"db:sync": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js schema:sync"
},
"dependencies": {
"@malereg/typeorm-model-urls": "git+ssh://git@github.com/maschinenlesbareregierung/typeorm-model-urls.git",
"@nestjs/common": "^7.6.11",
"@nestjs/core": "^7.6.11",
"@nestjs/platform-express": "^7.6.11",
"@nestjs/swagger": "^4.7.13",
"@nestjs/typeorm": "^7.1.5",
"@nestjsx/crud": "^5.0.0-alpha.3",
"@nestjsx/crud-typeorm": "^5.0.0-alpha.3",
"admin-bro": "^3.4.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-formidable": "^1.2.0",
"pg": "^8.5.1",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^6.6.3",
"swagger-ui-express": "^4.1.6",
"typeorm": "^0.2.30"
},
"devDependencies": {
"@nestjs/cli": "^7.5.5",
"@nestjs/schematics": "^7.2.7",
"@nestjs/testing": "^7.6.11",
"@types/express": "^4.17.11",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.31",
"@types/supertest": "^2.0.10",
"@typescript-eslint/eslint-plugin": "^4.15.0",
"@typescript-eslint/parser": "^4.15.0",
"eslint": "^7.19.0",
"eslint-config-prettier": "7.2.0",
"eslint-plugin-prettier": "^3.3.1",
"jest": "^26.6.3",
"nodemon": "^2.0.7",
"prettier": "^2.2.1",
"supertest": "^6.1.3",
"ts-jest": "^26.5.1",
"ts-loader": "^8.0.16",
"ts-node": "^9.1.1",
"tsconfig-paths": "^3.9.0",
"typescript": "4.1.5"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
Expected behavior
I expect the build to finish
Environment
Nest version:7.6.11
For Tooling issues:
- Node version: 15.15.1 <!-- run
node --version--> - Platform: Mac
Others: I get a build result that I can successfully start witn npm run start:prod
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (7 by maintainers)
I encountered the same issue while trying to update one of my apps that I hadn’t touched for about 6 months. It was really doing my head in.
My understanding is that the @types/eslint package requires a specific version of @types/estree. But in @types/eslint’s package json it has the following:
I solved it by adding the following package:
I spent a lot longer than I would like to admit figuring this out. I still don’t know where exactly things went wrong but I’m glad to have it solved and hopefully this can help others.
Edit: It seems one of my project’s dependencies insisted on using an older version estree which has then let me to this dependency hell? 😦
Ill try to get that together tomorrow. Thanks