Closed junxiaotan closed 3 months ago
Having the same issue using pnpm on a mac
Nx Version:
Pnpm Version:
Node Version:
package.json:
{
"name": "@app",
"version": "0.0.0",
"license": "MIT",
"scripts": {},
"private": true,
"devDependencies": {
"@angular-devkit/build-angular": "~17.3.7",
"@angular-devkit/core": "~17.3.7",
"@angular-devkit/schematics": "~17.3.7",
"@angular-eslint/eslint-plugin": "~17.3.0",
"@angular-eslint/eslint-plugin-template": "~17.3.0",
"@angular-eslint/template-parser": "~17.3.0",
"@angular/cli": "~17.3.7",
"@angular/compiler-cli": "~17.3.8",
"@angular/language-service": "~17.3.8",
"@nestjs/schematics": "^10.0.1",
"@nestjs/testing": "^10.0.2",
"@nx/angular": "19.0.2",
"@nx/devkit": "19.0.2",
"@nx/eslint": "19.0.2",
"@nx/eslint-plugin": "19.0.2",
"@nx/jest": "19.0.2",
"@nx/js": "19.0.2",
"@nx/nest": "19.0.2",
"@nx/node": "19.0.2",
"@nx/playwright": "19.0.2",
"@nx/web": "19.0.2",
"@nx/webpack": "19.0.2",
"@nx/workspace": "19.0.2",
"@playwright/test": "^1.44.0",
"@schematics/angular": "~17.3.7",
"@swc-node/register": "~1.8.0",
"@swc/core": "~1.5.7",
"@swc/helpers": "~0.5.11",
"@types/d3": "^7.4.3",
"@types/jest": "^29.5.12",
"@types/node": "18.16.9",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"autoprefixer": "^10.4.19",
"eslint": "~8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-playwright": "^0.15.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-environment-node": "^29.4.1",
"jest-preset-angular": "~14.0.4",
"nx": "19.0.2",
"postcss": "^8.4.38",
"prettier": "^2.8.8",
"tailwindcss": "^3.4.3",
"ts-jest": "^29.1.2",
"ts-node": "10.9.1",
"typescript": "~5.4.5",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@angular/animations": "~17.3.8",
"@angular/cdk": "^17.3.8",
"@angular/common": "~17.3.8",
"@angular/compiler": "~17.3.8",
"@angular/core": "~17.3.8",
"@angular/forms": "~17.3.8",
"@angular/material": "^17.3.8",
"@angular/platform-browser": "~17.3.8",
"@angular/platform-browser-dynamic": "~17.3.8",
"@angular/router": "~17.3.8",
"@nestjs/cli": "^10.3.2",
"@nestjs/common": "^10.0.2",
"@nestjs/core": "^10.0.2",
"@nestjs/platform-express": "^10.0.2",
"@nestjs/swagger": "^7.3.1",
"axios": "^1.6.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"d3": "^7.9.0",
"reflect-metadata": "^0.1.13",
"rxjs": "~7.8.1",
"tslib": "^2.6.2",
"zone.js": "~0.14.5"
}
}
Hey, can you create a repro I tested this and it's working correctly.
You can also try resetting the daemon using nx reset
https://github.com/junxiaotan/nx-latest-demo_bug
nx version: 19.0.3
run step:
pnpm install
npx nx run nest-demo:serve:development
PS:Using npx nx reset
also has the same Q&A questions
My device is Mac M2
node: v18.19.1
npx: 10.2.4
pnpm: 9.0.6
Running into the same issue - only when attempting to use pnpm. I can run my app: nx dev my-app, but can't lint, build, etc. Nx 19.0.2 Works fine when using npm. Frustrating...
I see exactly this issue in my setup, and I think I found the reason (at least in my case): adding package-lock.json
to .gitignore
results in The externalDependency 'vite' for 'react:build' could not be found
error.
I was able to reproduce this in a fresh container with fresh nx
project (no pnpm
involved).
Basic installation:
% docker run -it --rm node:20 bash
root@8556091efe34:/# node --version
v20.13.1
root@8556091efe34:/# npm --version
10.5.2
root@8556091efe34:/# npx create-nx-workspace
Need to install the following packages:
create-nx-workspace@19.0.6
Ok to proceed? (y) y
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Where would you like to create your workspace? · org
✔ Which stack do you want to use? · react
✔ What framework would you like to use? · none
✔ Integrated monorepo, or standalone project? · integrated
✔ Application name · org
✔ Which bundler would you like to use? · vite
✔ Test runner to use for end to end (E2E) tests · playwright
✔ Default stylesheet format · scss
✔ Set up CI with caching, distribution and test deflaking · skip
✔ Would you like remote caching to make your build faster? · skip
NX Creating your v19.0.6 workspace.
✔ Installing dependencies with npm
✔ Successfully created the workspace: org.
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'root@8556091efe34.(none)')
128
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Nx CLI is not installed globally.
This means that you will have to use "npx nx" to execute commands in the workspace.
Run "npm i -g nx" to be able to execute command directly.
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX First time using Nx? Check out this interactive Nx tutorial.
https://nx.dev/react-tutorial/1-code-generation
npm notice
npm notice New minor version of npm available! 10.5.2 -> 10.8.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.0
npm notice Run npm install -g npm@10.8.0 to update!
npm notice
root@8556091efe34:/# cd org
First build:
root@8556091efe34:/org# npx nx build org
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
> nx run org:build
> vite build
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
vite v5.0.13 building for production...
✓ 32 modules transformed.
../../dist/apps/org/index.html 0.47 kB │ gzip: 0.30 kB
../../dist/apps/org/assets/index-B_SY1GJM.css 0.00 kB │ gzip: 0.02 kB
../../dist/apps/org/assets/index-BVsD7syJ.js 366.19 kB │ gzip: 106.88 kB
✓ built in 2.80s
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Successfully ran target build for project org (3s)
Throwing the wrench and clearing :
root@8556091efe34:/org# echo -e "\npackage-lock.json" >> .gitignore
root@8556091efe34:/org# npx nx build org
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
NX The externalDependency 'vite' for 'org:build' could not be found
Pass --verbose to see the stacktrace.
Fixing things:
root@8556091efe34:/org# sed -i '/package-lock.json/d' .gitignore
root@8556091efe34:/org# npx nx build org
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
> nx run org:build
> vite build
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
vite v5.0.13 building for production...
✓ 32 modules transformed.
../../dist/apps/org/index.html 0.47 kB │ gzip: 0.30 kB
../../dist/apps/org/assets/index-B_SY1GJM.css 0.00 kB │ gzip: 0.02 kB
../../dist/apps/org/assets/index-BVsD7syJ.js 366.19 kB │ gzip: 106.88 kB
✓ built in 2.05s
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Successfully ran target build for project org (3s)
Found the answer to my problem. I was using version 9.x of pnpm. Go back to version 8.5.1 and everything is fine. It looks like 9.x isn't quite ready for primetime.
Hope this helps others...
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
https://github.com/junxiaotan/nx-latest-demo_bug nx version:
19.0.3
run step:
pnpm install
npx nx run nest-demo:serve:development
PS:Using
npx nx reset
also has the same Q&A questions
it's working for me thanks a lot!
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
nx nest serve error
Expected Behavior
nx nest ok
GitHub Repo
No response
Steps to Reproduce
npx create-nx-workspace@latest --pm pnpm
(None)npx nx --version
// Local: v19.0.2npx nx add @nx/nest
npx nx g @nx/nest:app nest-demo
npx nx run nest-demo:serve:development
(error)Please rerun the command, which will restart the daemon. If you get this error again, check for any errors in the daemon process logs found in: /Users/liujunzheng/webserver/localhost/nx/latest-demo/.nx/cache/d/daemon.log
Watch error: Daemon closed the connection
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Running target serve for project nest-demo failed
Failed tasks:
Hint: run the command with --verbose for more details.
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response