`npm install` in a project with 2 `nx` packages randomly fails with `npm ERR! code 135`
envgap__nrwl__nx-26517
Original GitHub issue ↗Opened 2024-06-11
01 / FAILURE SIGNATURE
As reported upstream
If it is true that two different `nx` versions can conflict when installing, then it would be helpful to handle it if possible
Not a benchmark task.
- No curated issue-specific recipe or verified environment fix is available.
02 / ENVIRONMENT RECIPE
- Base commit
Not freshly verified- Manifest
package.json- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
nrwl/nx #26517 · read the original issue
### Current Behavior
`npm install` on my CI job sometimes fails to complete because of a random postinstall failure.
I think it might be related to multiple different versions of `nx` package brought by `nx-dotnet`:
```
> npm ls nx
+-- @nx-dotnet/core@2.2.0
| +-- @nx-dotnet/utils@2.2.0
| | `-- @nx/devkit@17.0.2
| | `-- nx@18.3.5
| | `-- @nrwl/tao@18.3.5
| | `-- nx@18.3.5 deduped
| `-- @nx/devkit@17.0.2
| `-- nx@18.3.5
| `-- @nrwl/tao@18.3.5
| `-- nx@18.3.5 deduped
+-- @nx/devkit@19.2.3
| `-- nx@19.2.3 deduped
+-- @nx/js@19.2.3
| `-- @nx/workspace@19.2.3
| `-- nx@19.2.3 deduped
`-- nx@19.2.3
`-- @nrwl/tao@19.2.3
`-- nx@19.2.3 deduped
```
Also, I found that it never fails when I use
```shell
npm install --foreground-scripts
```
### Expected Behavior
If it is true that two different `nx` versions can conflict when installing, then it would be helpful to handle it if possible
### GitHub Repo
_No response_
### Steps to Reproduce
1. generate workspace with `nx@19.2.3` and `@nx-dotnet/core@2.2.0`
2. run `npm install`
In my case, I use an Ubuntu-based Jenkins job without `dotnet` (which might be important for nx-dotnet but shouldn't be a problem for overall `npm install` in `nx` workspace)
```groovy
pipeline {
agent {
docker { image 'mcr.microsoft.com/playwright:jammy' }
}
stages {
stage('Install dependencies') {
steps {
sh 'npm install --verbose'
}
}
}
}
```
### Nx Report
```shell
Node : 20.13.1
OS : linux-x64
npm : 10.5.2
nx : 19.2.3
@nx/js : 19.2.3
@nx/jest : 19.2.3
@nx/linter : 19.2.3
@nx/eslint : 19.2.3
@nx/workspace : 19.2.3
@nx/devkit : 19.2.3
@nx/eslint-plugin : 19.2.3
@nx/playwright : 19.2.3
@nrwl/tao : 19.2.3
typescript : 5.4.5
---------------------------------------
Registered Plugins:
@nx-dotnet/core
@nx/eslint/plugin
@nx/jest/plugin
---------------------------------------
Community plugins:
@nx-dotnet/core : 2.2.0
```
### Failure Logs
```shell
npm info run @nx-dotnet/core@2.2.0 postinstall node_modules/@nx-dotnet/core node ./src/tasks/post-install
npm info run @swc/core@1.5.7 postinstall node_modules/@swc/core node postinstall.js
npm info run nx@19.2.3 postinstall node_modules/nx node ./bin/post-install
npm info run @nx-dotnet/core@2.2.0 postinstall { code: 0, signal: null }
npm info run nx@18.3.5 postinstall node_modules/@nx-dotnet/core/node_modules/nx node ./bin/post-install
npm info run @swc/core@1.5.7 postinstall { code: 0, signal: null }
npm info run nx@18.3.5 postinstall node_modules/@nx-dotnet/utils/node_modules/nx node ./bin/post-install
npm info run nx@18.3.5 postinstall { code: 0, signal: null }
npm info run nx@18.3.5 postinstall { code: 135, signal: null }
npm info run nx@19.2.3 postinstall { code: 0, signal: null }
npm verb stack Error:04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]
Issue-specific recipe and runtime smoke command require review against the complete issue and repository.
Legacy reproduction is generic install-only; match the actual issue failure before admission.