Closed Markus-Ende closed 1 year ago
Hey @Markus-Ende,
Can you do the following?
Provide the dependency section of your root package.json
(all the dependencies
, devDependencies
etc.)
e.g.
{
"dependencies": {
// ...
},
"devDependencies": {
// ...
}
}
Go to node_modules/nx/src/lock-file/lock-file.js
and comment existing code in the yarn
if block in createLockFile
and replace it with return content
. This will return the existing root lock file and skip the broken part.
if (packageManager === 'yarn') {
// const graph = (0, yarn_parser_1.parseYarnLockfile)(content);
// const prunedGraph = (0, project_graph_pruning_1.pruneProjectGraph)(graph, packageJson);
// return (0, yarn_parser_1.stringifyYarnLockfile)(prunedGraph, content, normalizedPackageJson);
return content;
}
Run the build again
Copy also the generated package.json
from the dist folder. Again I'm only interested in the dependencies so you can omit the remaining stuff.
That should give me enough info to be able to reproduce your issue.
Hi @meeroslav,
thanks for reaching out.
"dependencies": {
"@angular/animations": "15.1.0",
"@angular/cdk": "15.1.0",
"@angular/common": "15.1.0",
"@angular/compiler": "15.1.0",
"@angular/core": "15.1.0",
"@angular/forms": "15.1.0",
"@angular/material": "15.1.0",
"@angular/material-date-fns-adapter": "15.1.0",
"@angular/platform-browser": "15.1.0",
"@angular/platform-browser-dynamic": "15.1.0",
"@angular/platform-server": "15.1.0",
"@angular/router": "15.1.0",
"@auth0/angular-jwt": "^5.1.2",
"@awesome-cordova-plugins/core": "^6.3.0",
"@awesome-cordova-plugins/deeplinks": "^6.3.0",
"@awesome-cordova-plugins/http": "^6.3.0",
"@aws-sdk/client-s3": "^3.245.0",
"@aws-sdk/s3-request-presigner": "^3.245.0",
"@bull-board/api": "^4.10.2",
"@bull-board/express": "^4.10.2",
"@capacitor/android": "^4.6.3",
"@capacitor/app": "4.1.1",
"@capacitor/browser": "4.1.0",
"@capacitor/core": "^4.6.3",
"@capacitor/device": "4.1.0",
"@capacitor/filesystem": "4.1.4",
"@capacitor/haptics": "4.1.0",
"@capacitor/keyboard": "4.1.0",
"@capacitor/network": "4.1.0",
"@capacitor/status-bar": "4.1.0",
"@ionic/angular": "^6.5.2",
"@ionic/storage-angular": "^3.0.6",
"@iplab/ngx-file-upload": "^15.0.0",
"@keycloak/keycloak-admin-client": "^18.0.0",
"@mdi/js": "^7.1.96",
"@nestjs-modules/mailer": "^1.8.1",
"@nestjs/axios": "^1.0.1",
"@nestjs/bull": "^0.6.2",
"@nestjs/common": "^9.2.1",
"@nestjs/config": "^2.2.0",
"@nestjs/core": "^9.2.1",
"@nestjs/jwt": "^10.0.1",
"@nestjs/microservices": "^9.2.1",
"@nestjs/ng-universal": "^6.1.0",
"@nestjs/passport": "^9.0.0",
"@nestjs/platform-express": "^9.2.1",
"@nestjs/swagger": "^6.1.4",
"@nestjs/terminus": "^9.1.4",
"@nestjs/throttler": "^3.1.0",
"@nestjs/typeorm": "^9.0.1",
"@ngneat/until-destroy": "^9.2.3",
"@ngrx-ducks/core": "^15.0.0",
"@ngrx/component-store": "15.0.0",
"@ngrx/effects": "15.0.0",
"@ngrx/entity": "15.0.0",
"@ngrx/router-store": "15.0.0",
"@ngrx/store": "15.0.0",
"@nrwl/angular": "15.7.0",
"@saninn/logger": "^1.1.0",
"@storybook/core-server": "6.5.15",
"@types/file-saver": "^2.0.5",
"@zip.js/zip.js": "^2.6.62",
"ably": "^1.2.34",
"angular-svg-icon": "^15.0.0",
"aws-sdk": "^2.1295.0",
"axe-core": "^4.6.2",
"axios": "1.2.1",
"base64-arraybuffer": "^1.0.2",
"bcryptjs": "^2.4.3",
"billomat-ts": "^0.2.0",
"bull": "^4.10.2",
"capacitor-secure-storage-plugin": "^0.8.1",
"cheerio": "^1.0.0-rc.10",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"cordova-plugin-advanced-http": "^3.3.1",
"cordova-plugin-file": "^7.0.0",
"cypress-axe": "^1.2.0",
"cypress-real-events": "^1.7.6",
"date-fns": "^2.29.3",
"exceljs": "^4.3.0",
"file-saver": "^2.0.5",
"handlebars": "^4.7.7",
"helmet": "^6.0.1",
"immer": "^9.0.18",
"ionic-plugin-deeplinks": "^1.0.24",
"keycloak-angular": "^13.0.0",
"keycloak-ionic": "^13.0.0",
"keycloak-js": "^20.0.3",
"marked": "^4.2.12",
"ms": "^2.1.3",
"mysql2": "^3.0.1",
"nestjs-paginate": "^4.6.3",
"nestjs-pino": "^3.1.2",
"ngx-clipboard": "^15.1.0",
"ngx-device-detector": "^4.0.1",
"ngx-markdown": "^15.1.0",
"ngx-mask": "^15.0.2",
"nodemailer": "^6.9.0",
"passport": "^0.6.0",
"passport-jwt": "^4.0.1",
"passport-keycloak-bearer": "^2.3.0",
"passport-local": "^1.0.0",
"pdfjs-dist": "^3.2.146",
"pino-http": "^8.3.1",
"pino-pretty": "^9.1.1",
"redis": "^4.5.1",
"reflect-metadata": "^0.1.13",
"rxjs": "~7.5.0",
"sharp": "^0.31.3",
"signature_pad": "^4.1.4",
"sqlite3": "^5.1.4",
"supertest": "6.3.3",
"swagger-ui-express": "^4.6.0",
"tslib": "^2.3.1",
"typeorm": "^0.3.6",
"unzipper": "^0.10.11",
"uuid": "^9.0.0",
"zone.js": "~0.11.5"
},
"devDependencies": {
"@angular-devkit/build-angular": "15.1.1",
"@angular-devkit/core": "~15.1.0",
"@angular-devkit/schematics": "~15.1.0",
"@angular-eslint/eslint-plugin": "15.0.0",
"@angular-eslint/eslint-plugin-template": "15.0.0",
"@angular-eslint/template-parser": "15.0.0",
"@angular/cli": "~15.1.0",
"@angular/compiler-cli": "15.1.0",
"@angular/language-service": "15.1.0",
"@babel/preset-env": "^7.16.11",
"@babel/preset-typescript": "^7.16.7",
"@capacitor/cli": "4.6.3",
"@commitlint/cli": "^17.4.2",
"@commitlint/config-angular": "^17.4.2",
"@cypress/webpack-batteries-included-preprocessor": "^2.3.0",
"@cypress/webpack-dev-server": "^2.5.0",
"@cypress/webpack-preprocessor": "^5.16.1",
"@ionic/cli": "^6.20.8",
"@mands/nx-playwright": "^0.2.1",
"@mocks-server/core": "^2.5.3",
"@mocks-server/cypress-commands": "^3.0.2",
"@mocks-server/plugin-admin-api": "^2.2.1",
"@nestjs/schematics": "^9.0.4",
"@nestjs/testing": "^9.2.1",
"@ngrx/schematics": "15.0.0",
"@ngrx/store-devtools": "15.0.0",
"@nguniversal/builders": "15.1.0",
"@nrwl/cli": "15.7.0",
"@nrwl/cypress": "15.7.0",
"@nrwl/devkit": "15.7.0",
"@nrwl/eslint-plugin-nx": "15.7.0",
"@nrwl/jest": "15.7.0",
"@nrwl/linter": "15.7.0",
"@nrwl/nest": "15.7.0",
"@nrwl/node": "15.7.0",
"@nrwl/nx-cloud": "15.0.3",
"@nrwl/storybook": "15.7.0",
"@nrwl/workspace": "15.7.0",
"@nxext/capacitor": "^15.2.0",
"@nxext/ionic-angular": "^15.1.0",
"@openapitools/openapi-generator-cli": "2.5.2",
"@playwright/test": "^1.29.2",
"@prettier/plugin-xml": "^2.2.0",
"@schematics/angular": "~15.1.0",
"@storybook/addon-essentials": "6.5.15",
"@storybook/angular": "6.5.15",
"@storybook/builder-webpack5": "6.5.15",
"@storybook/manager-webpack5": "6.5.15",
"@tailwindcss/forms": "^0.5.0",
"@testing-library/angular": "^13.1.0",
"@testing-library/cypress": "^9.0.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/user-event": "^14.4.3",
"@trumbitta/nx-plugin-openapi": "^1.10.0",
"@types/aws-lambda": "^8.10.109",
"@types/bcryptjs": "^2.4.2",
"@types/jest": "28.1.8",
"@types/marked": "^4.0.8",
"@types/ms": "^0.7.31",
"@types/node": "18.7.18",
"@types/node-mailjet": "^3.3.9",
"@types/nodemailer": "^6.4.7",
"@types/passport-jwt": "^3.0.8",
"@types/passport-local": "^1.0.35",
"@types/sharp": "^0.31.1",
"@types/supertest": "^2.0.12",
"@types/unzipper": "^0.10.5",
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "5.40.0",
"@typescript-eslint/parser": "5.40.0",
"@typestrong/ts-mockito": "^2.6.5",
"autoprefixer": "^10.4.13",
"concurrently": "^7.6.0",
"cross-env": "^7.0.3",
"cy-mobile-commands": "^0.3.0",
"cypress": "12.3.0",
"cypress-commands": "^3.0.0",
"date-fns-tz": "^1.3.7",
"dotenv": "10.0.0",
"eslint": "~8.15.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-cypress": "^2.10.3",
"eslint-plugin-jest": "^26.1.4",
"eslint-plugin-playwright": "^0.12.0",
"eslint-plugin-rxjs": "^5.0.2",
"eslint-plugin-rxjs-angular": "^2.0.0",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"eslint-plugin-unused-imports": "^2.0.0",
"html-webpack-plugin": "^5.5.0",
"husky": "^8.0.0",
"jasmine-marbles": "~0.9.2",
"jest": "28.1.3",
"jest-environment-jsdom": "28.1.1",
"jest-extended": "^2.0.0",
"jest-preset-angular": "12.2.3",
"lint-staged": "^13.1.0",
"native-run": "^1.5.0",
"ng-mockito": "3.0.0-next.1",
"ng-packagr": "15.1.1",
"node-notifier": "^10.0.1",
"nx": "15.7.0",
"open-file-explorer": "^1.0.2",
"playwright": "^1.29.2",
"postcss": "^8.4.21",
"postcss-import": "^15.1.0",
"postcss-preset-env": "^7.8.3",
"postcss-url": "10.1.3",
"prettier": "^2.8.3",
"prettier-plugin-java": "^2.0.0",
"prettier-plugin-kotlin": "^2.1.0",
"semver-parser": "^4.0.1",
"stylelint": "^14.16.1",
"stylelint-config-idiomatic-order": "^9.0.0",
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-standard": "^29.0.0",
"stylelint-config-standard-scss": "^6.1.0",
"svg-to-ts": "^9.0.0",
"tailwindcss": "^3.2.4",
"ts-jest": "28.0.8",
"ts-node": "10.9.1",
"typescript": "4.8.4",
"webpack": "^5.75.0"
},
"dependencies": {
"@angular/core": "15.1.0",
"@aws-sdk/client-s3": "^3.245.0",
"@aws-sdk/s3-request-presigner": "^3.245.0",
"@bull-board/api": "^4.10.2",
"@bull-board/express": "^4.10.2",
"@nestjs/axios": "^1.0.1",
"@nestjs/bull": "^0.6.2",
"@nestjs/common": "^9.2.1",
"@nestjs/config": "^2.2.0",
"@nestjs/core": "^9.2.1",
"@nestjs/jwt": "^10.0.1",
"@nestjs/microservices": "^9.2.1",
"@nestjs/passport": "^9.0.0",
"@nestjs/platform-express": "^9.2.1",
"@nestjs/swagger": "^6.1.4",
"@nestjs/terminus": "^9.1.4",
"@nestjs/throttler": "^3.1.0",
"@nestjs/typeorm": "^9.0.1",
"ably": "^1.2.34",
"axios": "1.2.1",
"bcryptjs": "^2.4.3",
"billomat-ts": "^0.2.0",
"bull": "^4.10.2",
"cheerio": "^1.0.0-rc.10",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"express": "4.17.3",
"helmet": "^6.0.1",
"nestjs-paginate": "^4.6.3",
"nestjs-pino": "^3.1.2",
"passport": "^0.6.0",
"passport-jwt": "^4.0.1",
"passport-keycloak-bearer": "^2.3.0",
"passport-local": "^1.0.0",
"passport-strategy": "1.0.0",
"pino-http": "^8.3.1",
"querystring": "0.2.0",
"reflect-metadata": "^0.1.13",
"rxjs": "~7.5.0",
"supertest": "6.3.3",
"tslib": "^2.3.1",
"typeorm": "^0.3.6",
"util": "0.12.5",
"uuid": "^9.0.0",
"zone.js": "~0.11.5"
},
"peerDependencies": {
"jest": "28.1.3"
},
All of the packages you see in the generated package.json
are found as a dependency of one of your files in that application. You can check in node_modules/.cache/nx/nxdeps.jso
in the cached project graph - find a node for your project (under "nodes") and then check "files" under "data". One of those files should have dependency to @angular/core
:
{
// ...
"nodes": {
// ...
"my-nest-app": {
// ...
"data": {
// ...
"files": [
{
"file": "app/my-nest-app/src/some/path/to/file.ts"
"hash": "...",
"deps": [
// ...
"npm:@angular/core" // <--- This is the culprit
// ...
]
}
]
}
}
// ...
},
// ...
}
Seeing that you have ranges in your generated package.json
I would assume your app has package.json
specified.
If that is true, can you also share dependencies in that file?
Actually, there's probably no need. I think I found the issue.
What was the issue?
Nvm rebuilding the package-lock.json
did it for me.
Just did
rm -rf ./node_modules
rm package-lock.json
npm i
@CollinKempkes check the linked PR.
All of the packages you see in the generated
package.json
are found as a dependency of one of your files in that application. You can check innode_modules/.cache/nx/nxdeps.jso
in the cached project graph - find a node for your project (under "nodes") and then check "files" under "data". One of those files should have dependency to@angular/core
:
Thanks for this tip! Found the guilty file :-)
The same error "Loop detected while pruning. Please report this issue." after updating node to 18.14.1 "lockfileVersion" in package-lock.json changed from 2 to 3
Trying to build NestJs app
"devDependencies": {
"@babel/preset-react": "^7.18.6",
"@nestjs/schematics": "9.0.4",
"@nestjs/testing": "9.3.9",
"@nrwl/cypress": "15.7.1",
"@nrwl/eslint-plugin-nx": "15.7.1",
"@nrwl/jest": "15.7.1",
"@nrwl/js": "15.7.1",
"@nrwl/linter": "15.7.1",
"@nrwl/nest": "15.7.1",
"@nrwl/next": "15.7.1",
"@nrwl/node": "15.7.1",
"@nrwl/react": "15.7.1",
"@nrwl/webpack": "15.7.1",
"@nrwl/workspace": "15.7.1",
"@swc/core": "1.3.35",
"@swc/jest": "0.2.24",
"@testing-library/react": "13.4.0",
"@types/cors": "^2.8.13",
"@types/jest": "29.4.0",
"@types/jsonwebtoken": "^9.0.1",
"@types/marked": "^4.0.8",
"@types/node": "18.13.0",
"@types/nodemailer": "^6.4.7",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"@types/react-timeago": "^4.1.3",
"@typescript-eslint/eslint-plugin": "5.52.0",
"@typescript-eslint/parser": "5.52.0",
"babel-jest": "29.4.3",
"cypress": "12.5.1",
"eslint": "8.34.0",
"eslint-config-next": "13.1.6",
"eslint-config-prettier": "8.6.0",
"eslint-plugin-cypress": "^2.10.3",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
"jest": "29.4.3",
"jest-environment-jsdom": "29.4.3",
"nx": "15.7.1",
"prettier": "2.8.4",
"prisma": "4.10.1",
"react-test-renderer": "18.2.0",
"sass": "1.58.1",
"ts-jest": "29.0.5",
"ts-node": "10.9.1",
"typescript": "4.9.5"
},
"dependencies": {
"@a2seven/yoo-checkout": "1.1.4",
"@dicebear/collection": "5.3.4",
"@dicebear/core": "5.3.4",
"@mantine/core": "5.10.4",
"@mantine/dates": "5.10.4",
"@mantine/form": "5.10.4",
"@mantine/hooks": "5.10.4",
"@mantine/next": "5.10.4",
"@mantine/notifications": "5.10.4",
"@mantine/spotlight": "5.10.4",
"@nestjs/axios": "2.0.0",
"@nestjs/common": "9.3.9",
"@nestjs/config": "2.3.1",
"@nestjs/core": "9.3.9",
"@nestjs/platform-express": "9.3.9",
"@next/font": "13.1.6",
"@prisma/client": "4.10.1",
"@reduxjs/toolkit": "1.9.2",
"@tabler/icons-react": "2.4.0",
"@tanstack/react-query": "4.24.6",
"@trpc/client": "10.11.1",
"@trpc/next": "10.11.1",
"@trpc/react-query": "10.11.1",
"@trpc/server": "10.11.1",
"axios": "1.3.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"cookies-next": "^2.1.1",
"gray-matter": "^4.0.3",
"ioredis": "5.3.1",
"jsonwebtoken": "^9.0.0",
"libphonenumber-js": "1.10.19",
"marked": "4.2.12",
"next": "13.1.6",
"next-auth": "4.19.2",
"nodemailer": "^6.9.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-redux": "^8.0.5",
"react-timeago": "^7.1.0",
"recharts": "2.4.2",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.0.0",
"simplex-noise": "^4.0.1",
"superjson": "1.12.2",
"tslib": "2.5.0",
"zod": "3.20.6"
}
Removing node_modules and package-lock.json, and npm i - not helping
Updated workspace to NX 15.7.2
nx migrate latest
npm i
npx nx migrate --run-migrations
Working like a charm! No error on NestJs app build
And... no. After several builds error returned.
Deleting node_modules and npm i - not helping.
HookWebpackError: Loop detected while pruning. Please report this issue.
at makeWebpackError (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/webpack/lib/HookWebpackError.js:48:9)
at /Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/webpack/lib/Compilation.js:3060:12
at eval (eval at create (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:23:1)
at fn (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/webpack/lib/Compilation.js:480:17)
at _next0 (eval at create (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:21:1)
at eval (eval at create (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:34:1)
at eval (eval at create (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
at /Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/webpack/lib/Compilation.js:502:10
at Hook.eval [as callAsync] (eval at create (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/tapable/lib/Hook.js:18:14)
-- inner error --
Error: Loop detected while pruning. Please report this issue.
at nestMappedPackages (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/nx/src/lock-file/npm-parser.js:307:15)
at nestMappedPackages (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/nx/src/lock-file/npm-parser.js:310:9)
at mapSnapshots (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/nx/src/lock-file/npm-parser.js:256:9)
at stringifyNpmLockfile (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/nx/src/lock-file/npm-parser.js:187:28)
at createLockFile (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/nx/src/lock-file/lock-file.js:123:54)
at /Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/@nrwl/webpack/src/plugins/generate-package-json-plugin.js:43:131
at fn (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/webpack/lib/Compilation.js:478:10)
at _next0 (eval at create (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:21:1)
at eval (eval at create (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:34:1)
at eval (eval at create (/Users/hmbanan666/WebstormProjects/monorepo-food/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
Building (some of the) nestjs apps fails with this error message:
Loop detected while pruning. Please report this issue.
Expected Behavior
build should work
GitHub Repo
No response
Steps to Reproduce
running affected:build on our (closed source) project.
Nx Report
Failure Logs
Additional Information
No response