Commit f17f570
fix: NPM Workspace throws
### Why?
This issue occurs when a project is NPM Workspace, and has no other
package managers but NPM is installed.
Next.js runs [npm config get
registry](https://github.com/vercel/next.js/blob/e35710f71f8e0f2844add1a97513a65a54a6f2a3/packages/next/src/lib/helpers/get-registry.ts#L13)
to fetch the registry.
However, running `npm config get registry` at a NPM Workspace is not
allowed resulting a `ENOWORKSPACES` error.
```
$ npm config get registry
npm error code ENOWORKSPACES
npm error This command does not support workspaces.
```
As we didn't consume the error, it threw when the enabled `next
telemetry` [triggered
getVersionInfo](https://github.com/vercel/next.js/blame/fb2d2dd01a5f73ac62c4809b7b9c1490617f8705/packages/next/src/server/dev/hot-reloader-webpack.ts#L725-L728)
calling `getRegistry` which threw as above.
### How?
Add `--no-workspaces` flag when the pkgManager is `'npm'`.
It is safe for non-workspace projects as it's equivalent to default
`--workspaces=false`.
Fixes #47121
Fixes NEXT-832
Fixes NDX-150
---------
Co-authored-by: Sebastian Silbermann <[email protected]>ENOWORKSPACES error when fetching registry (#68522)1 parent 44b85cb commit f17f570
1 file changed
+23
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
11 | 18 | | |
| 19 | + | |
12 | 20 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
24 | 34 | | |
25 | 35 | | |
26 | | - | |
27 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
28 | 40 | | |
| 41 | + | |
| 42 | + | |
29 | 43 | | |
0 commit comments