nx-labs
nx-labs copied to clipboard
Error: Command failed: npx nx affected:graph | nx-ignore
... [09:57:31.592] Cloning completed: 1.434s [09:57:31.592] Running "npx nx-ignore nrt --verbose" [09:57:32.868] npm WARN exec The following package was not found and will be installed: [email protected] [09:57:33.441] ≫ Using Nx to determine if this project (nrt) is affected by the commit... [09:57:33.441] ≫ Running from /vercel/.npm/_npx/cf7fc04e3df2a243/node_modules/nx-ignore/src [09:57:33.442] ≫ Workspace root is /vercel/path0 [09:57:33.444] ≫ Creating temp folder to install Nx: /tmp/.nx-ignore [09:57:40.208] npm WARN using --force Recommended protections disabled. [09:57:40.211] ≫ Found Nx at version 15.8.1 [09:57:40.211] [09:57:40.211] ≫ Validating base ref: d9c2015cae40795d8b93fe49d890f8bf26390fe4 [09:57:40.211] [09:57:40.218] [09:57:40.218] ≫ Comparing d9c2015cae40795d8b93fe49d890f8bf26390fe4...HEAD [09:57:40.219] [09:57:49.791] node:internal/errors:868 [09:57:49.791] const err = new Error(message); [09:57:49.791] ^ [09:57:49.792] [09:57:49.792] Error: Command failed: npx nx print-affected --base=d9c2015cae40795d8b93fe49d890f8bf26390fe4 --head=HEAD [09:57:49.792] at checkExecSyncError (node:child_process:885:11) [09:57:49.792] at execSync (node:child_process:957:15) [09:57:49.792] at /vercel/.npm/_npx/cf7fc04e3df2a243/node_modules/nx-ignore/src/index.js:67:24 [09:57:49.792] at Generator.next (<anonymous>) [09:57:49.792] at asyncGeneratorStep (/vercel/.npm/_npx/cf7fc04e3df2a243/node_modules/@swc/helpers/lib/_async_to_generator.js:13:28) [09:57:49.793] at _next (/vercel/.npm/_npx/cf7fc04e3df2a243/node_modules/@swc/helpers/lib/_async_to_generator.js:31:17) [09:57:49.793] at /vercel/.npm/_npx/cf7fc04e3df2a243/node_modules/@swc/helpers/lib/_async_to_generator.js:36:13 [09:57:49.793] at new Promise (<anonymous>) [09:57:49.793] at /vercel/.npm/_npx/cf7fc04e3df2a243/node_modules/@swc/helpers/lib/_async_to_generator.js:28:16 { [09:57:49.793] status: 1, [09:57:49.793] signal: null, [09:57:49.793] output: [ [09:57:49.794] null, [09:57:49.794] Buffer(89) [Uint8Array] [ [09:57:49.794] 10, 32, 62, 32, 32, 78, 88, 32, 32, 32, 67, 111, [09:57:49.794] 117, 108, 100, 32, 110, 111, 116, 32, 102, 105, 110, 100, [09:57:49.794] 32, 34, 46, 109, 111, 100, 117, 108, 101, 115, 46, 121, [09:57:49.794] 97, 109, 108, 34, 32, 97, 116, 32, 34, 47, 118, 101, [09:57:49.794] 114, 99, 101, 108, 47, 112, 97, 116, 104, 48, 47, 110, [09:57:49.794] 111, 100, 101, 95, 109, 111, 100, 117, 108, 101, 115, 47, [09:57:49.794] 46, 109, 111, 100, 117, 108, 101, 115, 46, 121, 97, 109, [09:57:49.795] 108, 34, 10, 10, 10 [09:57:49.795] ], [09:57:49.802] Buffer(0) [Uint8Array] [] [09:57:49.802] ], [09:57:49.802] pid: 170, [09:57:49.802] stdout: Buffer(89) [Uint8Array] [ [09:57:49.802] 10, 32, 62, 32, 32, 78, 88, 32, 32, 32, 67, 111, [09:57:49.804] 117, 108, 100, 32, 110, 111, 116, 32, 102, 105, 110, 100, [09:57:49.804] 32, 34, 46, 109, 111, 100, 117, 108, 101, 115, 46, 121, [09:57:49.804] 97, 109, 108, 34, 32, 97, 116, 32, 34, 47, 118, 101, [09:57:49.804] 114, 99, 101, 108, 47, 112, 97, 116, 104, 48, 47, 110, [09:57:49.804] 111, 100, 101, 95, 109, 111, 100, 117, 108, 101, 115, 47, [09:57:49.805] 46, 109, 111, 100, 117, 108, 101, 115, 46, 121, 97, 109, [09:57:49.805] 108, 34, 10, 10, 10 [09:57:49.805] ], [09:57:49.805] stderr: Buffer(0) [Uint8Array] [] [09:57:49.805] } [09:57:49.805] [09:57:49.805] Node.js v18.13.0 [09:57:52.526] Restored build cache ...
For example, in a deployment two weeks ago, it also worked in version
15.6.0
. I therefore think that it does not necessarily have anything to do with the change mentioned. But I am not sure about that.
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
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/[email protected]/node_modules/nx-ignore/src
≫ Workspace root is /vercel/path0
≫ Creating temp folder to install Nx: /tmp/.nx-ignore
≫ Adding plugin @nx/[email protected]
≫ Adding plugin @nx/[email protected]
≫ Adding plugin @nx/[email protected]
≫ 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/[email protected]/node_modules/nx-ignore/src/index.js:60:5)
at Object.<anonymous> (/vercel/.local/share/pnpm/store/v3/tmp/dlx-85/node_modules/.pnpm/[email protected]/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/[email protected]
≫ Adding plugin @nx/[email protected]
≫ Adding plugin @nx/[email protected]
≫ Adding @nx/devkit
Using npm to install Nx.
npm WARN using --force Recommended protections disabled.
npm WARN deprecated [email protected]: 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"
]
}
Related Issues
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:
- 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.
@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: [email protected]
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