Open mattleong opened 2 months ago
My specific error:
Cloning completed: 409.534ms
Running "pnpm dlx nx-ignore test-app --verbose"
Progress: resolved 1, reused 0, downloaded 0, added 0
Packages: +7
+++++++
Progress: resolved 7, reused 0, downloaded 7, added 7, done
≫ Using Nx to determine if this project (test-app) is affected by the commit...
≫ Running from /vercel/.local/share/pnpm/store/v3/tmp/dlx-85/node_modules/.pnpm/nx-ignore@18.0.2/node_modules/nx-ignore/src
≫ Workspace root is /vercel/path0
≫ Creating temp folder to install Nx: /tmp/.nx-ignore
≫ Adding plugin @nx/next@18.2.4
≫ Adding plugin @nx/jest@18.2.4
≫ Adding plugin @nx/eslint@18.2.4
≫ Adding @nx/devkit
Found pnpm version 8.15.6
.
Using pnpm to install Nx.
≫ Found Nx at version 18.2.4
≫ Validating base ref: 6f27b0282e12af9a46cf05c3b67248893dc262f2
≫ Comparing 6f27b0282e12af9a46cf05c3b67248893dc262f2...HEAD
node:internal/errors:984
const err = new Error(message);
^
Error: Command failed: npx nx affected:graph --base=6f27b0282e12af9a46cf05c3b67248893dc262f2 --head=HEAD --file=/tmp/.nx-affected-graph.json
at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at checkExecSyncError (node:child_process:890:11)
at execSync (node:child_process:962:15)
at main (/vercel/.local/share/pnpm/store/v3/tmp/dlx-85/node_modules/.pnpm/nx-ignore@18.0.2/node_modules/nx-ignore/src/index.js:60:5)
at Object.<anonymous> (/vercel/.local/share/pnpm/store/v3/tmp/dlx-85/node_modules/.pnpm/nx-ignore@18.0.2/node_modules/nx-ignore/src/index.js:27:1)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
at Module._load (node:internal/modules/cjs/loader:1022:12) {
status: 1,
signal: null,
output: [
null,
Buffer(81) [Uint8Array] [
10, 32, 78, 88, 32, 32, 32, 70, 97, 105, 108, 101,
100, 32, 116, 111, 32, 112, 114, 111, 99, 101, 115, 115,
32, 112, 114, 111, 106, 101, 99, 116, 32, 103, 114, 97,
112, 104, 46, 10, 10, 80, 97, 115, 115, 32, 45, 45,
118, 101, 114, 98, 111, 115, 101, 32, 116, 111, 32, 115,
101, 101, 32, 116, 104, 101, 32, 115, 116, 97, 99, 107,
116, 114, 97, 99, 101, 115, 46, 10, 10
],
Buffer(0) [Uint8Array] []
],
pid: 253,
stdout: Buffer(81) [Uint8Array] [
10, 32, 78, 88, 32, 32, 32, 70, 97, 105, 108, 101,
100, 32, 116, 111, 32, 112, 114, 111, 99, 101, 115, 115,
32, 112, 114, 111, 106, 101, 99, 116, 32, 103, 114, 97,
112, 104, 46, 10, 10, 80, 97, 115, 115, 32, 45, 45,
118, 101, 114, 98, 111, 115, 101, 32, 116, 111, 32, 115,
101, 101, 32, 116, 104, 101, 32, 115, 116, 97, 99, 107,
116, 114, 97, 99, 101, 115, 46, 10, 10
],
stderr: Buffer(0) [Uint8Array] []
}
@mattleong Can you run npx nx affected:graph --base=6f27b0282e12af9a46cf05c3b67248893dc262f2 --head=HEAD --file=/tmp/.nx-affected-graph.json
locally and see what the error is?
Can you also paste the results of nx report
?
@jaysoo No issue locally
~/dev/repo main ❯ npx nx affected:graph --base=6f27b0282e12af9a46cf05c3b67248893dc262f2 --head=HEAD --file=/tmp/.nx-affected-graph.json 07:58:40 AM
NX Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 19.
NX JSON output contains deprecated fields:
- affectedProjects
- criticalPath
These fields will be removed in Nx 19. If you need to see which projects were affected, use `nx show projects --affected`.
NX JSON output created in /tmp
/tmp/.nx-affected-graph.json
NX Report
~/dev/repo main* ❯ pnpm dlx nx report 12:02:11 PM
.../Library/pnpm/store/v3/tmp/dlx-23216 | +111 +++++++++++
.../Library/pnpm/store/v3/tmp/dlx-23216 | Progress: resolved 120, reused 111, downloaded 0, added 111, done
NX Report complete - copy this into the issue template
Node : 20.11.0
OS : darwin-x64
pnpm : 8.5.1
nx (global) : 18.2.4
nx : 18.2.4
@nx/js : 18.2.4
@nx/jest : 18.2.4
@nx/eslint : 18.2.4
@nx/workspace : 18.2.4
@nx/eslint-plugin : 18.2.4
@nx/next : 18.2.4
@nx/react : 18.2.4
@nrwl/tao : 18.2.4
@nx/vite : 18.2.4
@nx/web : 18.2.4
typescript : 5.4.5
---------------------------------------
Registered Plugins:
@nx/next/plugin
@nx/jest/plugin
@nx/eslint/plugin
@mattleong If you have a public repo that we can check that will help a lot in debugging this issue. Otherwise, I'll try to reproduce it, but it will take longer to fix.
@jaysoo unforunately, it's not public at the moment. I'll let you know if I can change that
I have a similar problem, and since I see there are many (see some related issues below) issues already created for this, I wonder if I should create a separate one.
My issue is the following:
npx nx-ignore www --verbose
≫ Using Nx to determine if this project (www) is affected by the commit...
≫ Running from /Users/luis/.npm/_npx/cf7fc04e3df2a243/node_modules/nx-ignore/src
≫ Workspace root is /Users/luis/projects/bulletninja.com
≫ Creating temp folder to install Nx: /var/folders/yb/tph2jpl56_j0qvr1hq2nm_280000gn/T/.nx-ignore
≫ Adding plugin @nx/next@18.2.3
≫ Adding plugin @nx/jest@18.2.3
≫ Adding plugin @nx/eslint@18.2.3
≫ Adding @nx/devkit
Using npm to install Nx.
npm WARN using --force Recommended protections disabled.
npm WARN deprecated abab@2.0.6: Use your platform's native atob() and btoa() methods instead
≫ Found Nx at version 18.2.3
≫ Comparing HEAD^...HEAD
node:internal/errors:984
const err = new Error(message);
^
Error: Command failed: npx nx affected:graph --base=HEAD^ --head=HEAD --file=/var/folders/yb/tph2jpl56_j0qvr1hq2nm_280000gn/T/.nx-affected-graph.json
at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at checkExecSyncError (node:child_process:890:11)
at execSync (node:child_process:962:15)
at main (/Users/luis/.npm/_npx/cf7fc04e3df2a243/node_modules/nx-ignore/src/index.js:60:5)
at Object.<anonymous> (/Users/luis/.npm/_npx/cf7fc04e3df2a243/node_modules/nx-ignore/src/index.js:27:1)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
at Module._load (node:internal/modules/cjs/loader:1022:12) {
status: 1,
signal: null,
output: [
null,
Buffer(81) [Uint8Array] [
10, 32, 78, 88, 32, 32, 32, 70, 97, 105, 108, 101,
100, 32, 116, 111, 32, 112, 114, 111, 99, 101, 115, 115,
32, 112, 114, 111, 106, 101, 99, 116, 32, 103, 114, 97,
112, 104, 46, 10, 10, 80, 97, 115, 115, 32, 45, 45,
118, 101, 114, 98, 111, 115, 101, 32, 116, 111, 32, 115,
101, 101, 32, 116, 104, 101, 32, 115, 116, 97, 99, 107,
116, 114, 97, 99, 101, 115, 46, 10, 10
],
Buffer(0) [Uint8Array] []
],
pid: 16028,
stdout: Buffer(81) [Uint8Array] [
10, 32, 78, 88, 32, 32, 32, 70, 97, 105, 108, 101,
100, 32, 116, 111, 32, 112, 114, 111, 99, 101, 115, 115,
32, 112, 114, 111, 106, 101, 99, 116, 32, 103, 114, 97,
112, 104, 46, 10, 10, 80, 97, 115, 115, 32, 45, 45,
118, 101, 114, 98, 111, 115, 101, 32, 116, 111, 32, 115,
101, 101, 32, 116, 104, 101, 32, 115, 116, 97, 99, 107,
116, 114, 97, 99, 101, 115, 46, 10, 10
],
stderr: Buffer(0) [Uint8Array] []
}
Node.js v20.12.2
Tried with node 18 at first, and got the same error,
However, if i Run the command as sugested:
npx nx affected:graph --base=HEAD^ --head=HEAD --file=/var/folders/yb/tph2jpl56_j0qvr1hq2nm_280000gn/T/.nx-affected-graph.json
I get no errors
npx nx affected:graph --base=HEAD^ --head=HEAD --file=/var/folders/yb/tph2jpl56_j0qvr1hq2nm_280000gn/T/.nx-affected-graph.json
NX Use `nx graph --affected`, or `nx affected --graph` instead depending on which best suits your use case. The `affected:graph` command will be removed in Nx 19.
NX JSON output contains deprecated fields:
- affectedProjects
- criticalPath
These fields will be removed in Nx 19. If you need to see which projects were affected, use `nx show projects --affected`.
NX JSON output created in /var/folders/yb/tph2jpl56_j0qvr1hq2nm_280000gn/T
/var/folders/yb/tph2jpl56_j0qvr1hq2nm_280000gn/T/.nx-affected-graph.json
and the file's content:
{
"graph": {
"nodes": {
"blog": {
"name": "blog",
"type": "app",
"data": {
"root": "blog",
"targets": {
"build": {
"executor": "@nx/next:build",
"outputs": [
"{options.outputPath}"
],
"options": {
"root": "blog",
"outputPath": "blog/dist"
},
"configurations": {}
},
"dev": {
"options": {
"cwd": "blog",
"command": "next dev"
},
"executor": "nx:run-commands",
"configurations": {}
},
"start": {
"options": {
"cwd": "blog",
"command": "next start"
},
"dependsOn": [
"build"
],
"executor": "nx:run-commands",
"configurations": {}
},
"serve-static": {
"executor": "@nx/web:file-server",
"options": {
"buildTarget": "build",
"staticFilePath": "blog/out",
"port": 3000,
"spa": false
},
"configurations": {}
},
"test": {
"options": {
"cwd": "blog",
"command": "jest"
},
"cache": true,
"inputs": [
"default",
"^production",
{
"externalDependencies": [
"jest"
]
}
],
"outputs": [
"{workspaceRoot}/coverage/blog"
],
"executor": "nx:run-commands",
"configurations": {}
},
"lint": {
"cache": true,
"options": {
"cwd": "blog",
"command": "eslint ."
},
"inputs": [
"default",
"^default",
"{workspaceRoot}/.eslintrc.json",
"{projectRoot}/.eslintrc.json",
"{workspaceRoot}/tools/eslint-rules/**/*",
{
"externalDependencies": [
"eslint"
]
}
],
"executor": "nx:run-commands",
"configurations": {}
},
"serve": {
"executor": "@nx/next:server",
"options": {
"buildTarget": "blog:build",
"dev": true
},
"configurations": {}
}
},
"name": "blog",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "blog",
"projectType": "application",
"tags": [],
"implicitDependencies": []
}
},
"www": {
"name": "www",
"type": "app",
"data": {
"root": "www",
"targets": {
"build": {
"executor": "@nx/next:build",
"outputs": [
"{options.outputPath}"
],
"options": {
"root": "www",
"outputPath": "www/dist"
},
"configurations": {}
},
"dev": {
"options": {
"cwd": "www",
"command": "next dev"
},
"executor": "nx:run-commands",
"configurations": {}
},
"start": {
"options": {
"cwd": "www",
"command": "next start"
},
"dependsOn": [
"build"
],
"executor": "nx:run-commands",
"configurations": {}
},
"serve-static": {
"executor": "@nx/web:file-server",
"options": {
"buildTarget": "build",
"staticFilePath": "www/out",
"port": 3000,
"spa": false
},
"configurations": {}
},
"test": {
"options": {
"cwd": "www",
"command": "jest"
},
"cache": true,
"inputs": [
"default",
"^production",
{
"externalDependencies": [
"jest"
]
}
],
"outputs": [
"{workspaceRoot}/coverage/www"
],
"executor": "nx:run-commands",
"configurations": {}
},
"lint": {
"cache": true,
"options": {
"cwd": "www",
"command": "eslint ."
},
"inputs": [
"default",
"^default",
"{workspaceRoot}/.eslintrc.json",
"{projectRoot}/.eslintrc.json",
"{workspaceRoot}/tools/eslint-rules/**/*",
{
"externalDependencies": [
"eslint"
]
}
],
"executor": "nx:run-commands",
"configurations": {}
},
"serve": {
"executor": "@nx/next:server",
"options": {
"buildTarget": "www:build",
"dev": true
},
"configurations": {}
}
},
"name": "www",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "www",
"projectType": "application",
"tags": [],
"implicitDependencies": []
}
},
"cv": {
"name": "cv",
"type": "app",
"data": {
"root": "cv",
"targets": {
"build": {
"options": {
"cwd": "cv",
"command": "next build"
},
"dependsOn": [
"^build"
],
"cache": true,
"inputs": [
"default",
"^production",
{
"externalDependencies": [
"next"
]
}
],
"outputs": [
"{workspaceRoot}/cv/.next",
"{workspaceRoot}/cv/.next/!(cache)"
],
"executor": "nx:run-commands",
"configurations": {}
},
"dev": {
"options": {
"cwd": "cv",
"command": "next dev"
},
"executor": "nx:run-commands",
"configurations": {}
},
"start": {
"options": {
"cwd": "cv",
"command": "next start"
},
"dependsOn": [
"build"
],
"executor": "nx:run-commands",
"configurations": {}
},
"serve-static": {
"executor": "@nx/web:file-server",
"options": {
"buildTarget": "build",
"staticFilePath": "cv/out",
"port": 3000,
"spa": false
},
"configurations": {}
},
"test": {
"options": {
"cwd": "cv",
"command": "jest"
},
"cache": true,
"inputs": [
"default",
"^production",
{
"externalDependencies": [
"jest"
]
}
],
"outputs": [
"{workspaceRoot}/coverage/cv"
],
"executor": "nx:run-commands",
"configurations": {}
},
"lint": {
"cache": true,
"options": {
"cwd": "cv",
"command": "eslint ."
},
"inputs": [
"default",
"^default",
"{workspaceRoot}/.eslintrc.json",
"{projectRoot}/.eslintrc.json",
"{workspaceRoot}/tools/eslint-rules/**/*",
{
"externalDependencies": [
"eslint"
]
}
],
"executor": "nx:run-commands",
"configurations": {}
}
},
"name": "cv",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "cv",
"projectType": "application",
"tags": [],
"implicitDependencies": []
}
}
},
"dependencies": {
"blog": [],
"www": [],
"cv": []
}
},
"affectedProjects": [
"www"
],
"criticalPath": [
"www"
]
}
https://github.com/nrwl/nx-labs/issues/388 https://github.com/nrwl/nx-labs/issues/360 https://github.com/nrwl/nx-labs/issues/314 https://github.com/nrwl/nx-labs/issues/124 https://github.com/nrwl/nx-labs/issues/113 https://github.com/nrwl/nx-labs/issues/86 https://github.com/nrwl/nx-labs/issues/80
@Bulletninja @mattleong Can you try again with the latest version? I made two changes:
nx.json
).@Bulletninja @mattleong Can you try again with the latest version? I made two changes:
- Perform a full install when needed (e.g. when you use Nx plugins in
nx.json
).- Better error log when the affected graph fails to generate.
Great @jaysoo, I just reinstalled and now it works, thanks!
@jaysoo Sorry for the delay
Using npx nx-ignore <app-name>
, I'm now getting this error:
npm WARN exec The following package was not found and will be installed: nx-ignore@18.3.7
15:45:14.258 | ≫ Using Nx to determine if this project (test-app) is affected by the commit...
15:46:02.512 | node:fs:582
15:46:02.513 | return binding.open(
15:46:02.513 | ^
15:46:02.513 |
15:46:02.513 | Error: ENOENT: no such file or directory, open '/tmp/.nx-affected-graph.json'
15:46:02.514 | at Object.openSync (node:fs:582:18)
15:46:02.514 | at readFileSync (node:fs:461:35)
15:46:02.514 | at main (/vercel/.npm/_npx/cf7fc04e3df2a243/node_modules/nx-ignore/src/index.js:75:33)
15:46:02.514 | at Object.<anonymous> (/vercel/.npm/_npx/cf7fc04e3df2a243/node_modules/nx-ignore/src/index.js:33:1)
15:46:02.514 | at Module._compile (node:internal/modules/cjs/loader:1369:14)
15:46:02.514 | at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
15:46:02.515 | at Module.load (node:internal/modules/cjs/loader:1206:32)
15:46:02.515 | at Module._load (node:internal/modules/cjs/loader:1022:12)
15:46:02.515 | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
15:46:02.515 | at node:internal/main/run_main_module:28:49 {
15:46:02.515 | errno: -2,
15:46:02.515 | code: 'ENOENT',
15:46:02.516 | syscall: 'open',
15:46:02.516 | path: '/tmp/.nx-affected-graph.json'
15:46:02.516 | }
15:46:02.516
@jaysoo I can confirm this is broken now with NX 19.0.3, and nx-ignore 18.3.7
@jaysoo I can confirm this is broken now with NX 19.0.3, and nx-ignore 18.3.7
Ok so removing node modules and package lock and reinstalling seems to do the trick
I'm seeing this issue with NX v18.2.4 and nx-ignore v18.0.2
Originally posted by @mattleong in https://github.com/nrwl/nx-labs/issues/178#issuecomment-2052626528