Open joepetrillo opened 1 year ago
I cannot reproduce it on my machine, even with next@canary
, but this might be related to https://github.com/vercel/next.js/blob/67aceea72ba1b20063078d887f90739301bc4a80/packages/next/src/lib/helpers/get-registry.ts#L13
Which was added as part of #44234 to show the version of Next.js in the error overlay.
The first release was 13.1.7-canary.18 though, so it's unclear how you can reproduce this in 13.1.6
.
Could you be able to track down the exact canary
version this broke? :pray: As said, I, unfortunately, cannot reproduce. :thinking: It's strange because the command is also wrapped in try..catch
so in theory it should not break.
The getRegistry
function is called in a few places, it might be related to one of them:
Thanks for looking into this! I should have been more clear - this error does NOT happen on 13.1.6. Every major release AFTER 13.1.6 does throw this error. I had a few other people try to reproduce and they got the same error, it’s strange it’s not happening for you.
I will try to figure out exactly what canary version it started on.
Yeah, I understood your message, the fuzzy part was how it was happening between 13.1.6
- 13.1.7-canary.18
, since the change (which I think is relevant) was added in 13.1.17-canary.18
.
Tracking down the exact canary version will help a lot though! :pray:
Ok so I just tested each version and it starts happening at exactly 13.1.7-canary.18
like you thought!
If anyone else is able to reproduce this, it could be helpful to know if you are using any sort of node package manager or if you have any sort of .npmrc
config. I will try to find a few others who have already reproduced this to give me their info.
We run into the exact same issue and we are using n.
I'm seeing the same error on next 13.2.4
.
I'm using nvm version 0.39.3
with node v18.15.0
.
Running npm config get registry
in my nextjs workspace does indeed produce the exact same error. It works without issues when running in the root directory that contains all the workspaces.
Also happening here running next 13.2.4
, with turbo 1.4.3
, node 18 and npm 9.5.0
Still seeing this on
next 13.2.4
turbo 1.8.5
npm 9.5.0
Getting the same error while following the Turborepo tutorial:
Not using a version manager, installed node with homebrew.
Next Version: "next": "^13.1.1", (13.2.4)
31 timing npm:load Completed in 14ms
32 timing command:config Completed in 1ms
33 verbose stack Error: This command does not support workspaces.
33 verbose stack at Config.cmdExec (/opt/homebrew/lib/node_modules/npm/lib/base-command.js:123:29)
33 verbose stack at Npm.exec (/opt/homebrew/lib/node_modules/npm/lib/npm.js:154:20)
33 verbose stack at async module.exports (/opt/homebrew/lib/node_modules/npm/lib/cli.js:134:5)
34 verbose cwd /Users/x/Projects/test/apps/web
35 verbose Darwin 22.3.0
36 verbose node v19.8.1
37 verbose npm v9.6.2
38 error code ENOWORKSPACES
39 error This command does not support workspaces.
40 verbose exit 1
I get the error with 3.1.6 also on first dev server start, seemingly it tries to patch lock file
ready - started server on 0.0.0.0:3030, url: http://localhost:3030
info - Loaded env from /Users/jibyjose/Projects/aurum-one/web/dashboard/.env
warn - The `app` directory is experimental. To enable, add `appDir: true` to your `next.config.js` configuration under `experimental`. See https://nextjs.org/docs/messages/experimental-app-dir-config
warn - The `app` directory is experimental. To enable, add `appDir: true` to your `next.config.js` configuration under `experimental`. See https://nextjs.org/docs/messages/experimental-app-dir-config
info - automatically enabled Fast Refresh for 1 custom loader
warn - Found lockfile missing swc dependencies, patching...
npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jibyjose/.npm/_logs/2023-03-28T13_55_04_964Z-debug-0.log
event - compiled client and server successfully in 2s (4135 modules)
warn - Lockfile was successfully patched, please run "npm install" to ensure @next/swc dependencies are downloaded
I have continued using it with this error and everything seems to work fine - obviously would still be nice to have fixed.
I also receive the same error when I spin up a dev server on a turborepo/next/npm project. Everything still builds and runs like @joepetrillo stated.
Error:
npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.
npm ERR! A complete log of this run can be found in: ...
Package versions:
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"turbo": "1.8.3",
node/npm versions:
node --version
v18.15.0
npm --version
9.5.0
Hey folks! I've just seen this same error with another developer I'm working with.
We both have very similar developer environment setups, but they were seeing ENOWORKSPACES
when running next dev
for an npm workspace via npm run dev -w=client
, and I was not seeing any error. This is a brand new project we weren't expecting any issues with, so we've investigated why our systems were behaving differently.
Following the comments above pointing at npm config get registry
and recent changes to getRegistry
, I added some debugging to my local Next package so we could step through the code. getRegistry
first tries to find out which package manager is being used, so we step through getPkgManager
:
npm/9.5.0 node/v18.15.0 darwin arm64 workspaces/true
)getPkgManager
returns yarn
for an npm workspace. My friend does not have yarn installed, so it falls to return 'npm'
by default.Finally, in getRegistry
my machine runs yarn config get registry
and the other machine runs npm config get registry
.
yarn config get registry
does not raise this workspace error, but npm config get registry
does 😅
My guess is that the other folks here unable to reproduce the error have either yarn or pnpm installed, whereas people seeing the error do not.
Perhaps getRegistry
should be updated to silently swallow this error? I'd also propose a fix for getPkgManager
to identify npm in this case, but in practice that might just mean that more people see an unhelpful error!
Run npx next telemetry disable
to disable Next telemetry. That skips this whole check so you'll see no error, and I've also found it's made next dev
start up faster for me 🙂
npx next telemetry disable
Yep - fixed it for me!!! 🎉
Disabling telemetry fixes this for me! I can also confirm that I do not have yarn or pnpm installed.
I guess I’m not sharing any data with Vercel for the time being 😆
this did the trick. thanks
Ran into the same issue, disabling telemetry worked around the issue... On my pc.
Other people in my team are still experiencing this issue. So, despite positive comments, it's not actually fixed yet.
jacobpgn
Thank you so much for this - super helpful!
Hey folks! I've just seen this same error with another developer I'm working with.
We both have very similar developer environment setups, but they were seeing
ENOWORKSPACES
when runningnext dev
for an npm workspace vianpm run dev -w=client
, and I was not seeing any error. This is a brand new project we weren't expecting any issues with, so we've investigated why our systems were behaving differently.Following the comments above pointing at
npm config get registry
and recent changes togetRegistry
, I added some debugging to my local Next package so we could step through the code.getRegistry
first tries to find out which package manager is being used, so we step throughgetPkgManager
:
- Check for lockfiles falls through, as npm workspaces don't have their own lockfiles.
- Check for user agent falls through with no matches (mine looks like
npm/9.5.0 node/v18.15.0 darwin arm64 workspaces/true
)- ⚠️ Check to see if yarn is installed passes. I have yarn installed, though I'm not using it for this project, so
getPkgManager
returnsyarn
for an npm workspace. My friend does not have yarn installed, so it falls toreturn 'npm'
by default.Finally, in
getRegistry
my machine runsyarn config get registry
and the other machine runsnpm config get registry
.
yarn config get registry
does not raise this workspace error, butnpm config get registry
does 😅My guess is that the other folks here unable to reproduce the error have either yarn or pnpm installed, whereas people seeing the error do not.
Perhaps
getRegistry
should be updated to silently swallow this error? I'd also propose a fix forgetPkgManager
to identify npm in this case, but in practice that might just mean that more people see an unhelpful error!potential quick fix for users
Run
npx next telemetry disable
to disable Next telemetry. That skips this whole check so you'll see no error, and I've also found it's madenext dev
start up faster for me 🙂
Thank you!
As an alternative, if you don't want to use npx next telemetry disable
you can set this environment variable inside your .env
file NEXT_TELEMETRY_DISABLED=1
Thank you so much...! I have faced the same issue, that can resolved with npx next telemetry disable
But this fix only run the docs not the web.
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
Dev server and NPM
Link to the code that reproduces this issue
https://github.com/joepetrillo/workspace-issue
To Reproduce
Clone the repo then
npm install
thencd reproduction-app
thennpm run dev
Describe the Bug
I have determined that this error happens when a nextjs (versions after 13.1.6) dev server runs in an npm workspace.
npm config get registry
is getting called sometime during the dev server startup and is throwing an error since it is not supported in workspaces.error code ENOWORKSPACES
error This command does not support workspaces.
I initially thought this could be a turborepo issue, but it is not. More details are in the issue I initially opened (linked below).
https://github.com/vercel/turbo/issues/4183
And here is a sample error log:
Expected Behavior
No error
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
NEXT-832