turbo: [turborepo] NPM error code ENOWORKSPACES with NextJS

What version of Turborepo are you using?

1.8.3

What package manager are you using / does the bug impact?

npm

What operating system are you using?

Mac

Describe the Bug

Performing turbo run dev on the latest NextJS version (13.2.4) causes the ENOWORKSPACES npm error during startup.

error code ENOWORKSPACES error This command does not support workspaces.

Expected Behavior

No errors

To Reproduce

Clone the reproduction repo, run npm install and npm run dev. In the apps directory I setup two barebones nextjs starters. latest causes the issue and older does not.

This is happening for me on node version 18.15.0 and NPM version 9.6.1.

Reproduction Repo

https://github.com/joepetrillo/turbo-issue

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 15
  • Comments: 26 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I run into the same issue when creating a completely empty repo using npx create-turbo@latest my_repo and running npm run dev.

npx next telemetry disable worked for me

Same error using "turbo": "^1.9.3" "packageManager": "npm@9.5.1", and using node -v v18.16.0

Seeing this as well after upgrading to Next 13.2.4 from Next 13.1.6. Downgrading Next.js made it go away again. Turbo version is 1.8.3. Node is 18.15.0 with npm 9.5.0.

Same error here as well:

npm: 9.5.1
next: 13.4.0
turbo: 1.10.3

Sorry for the spam, but also want to mention here that I just tried running a fresh 13.2.4 nextjs app standalone (not using turbo or workspaces) and I am not seeing the error thrown anywhere.

This error happens when a nextjs (versions after 13.1.6) dev server runs in an npm workspace.

same error as well

Also getting this same error with:

nx: 16.2.1
next: 13.3.0
pnpm: 7.11.0

We have workspaces setup in the package.json and in the pnpm-workspace.yaml

I do not have any global .npmrc or config setup (fresh default node/NPM install). I’m surprised you didn’t get any error, do you have a .npmrc? @nathanhammond

Looks like a few others are also seeing this while using storybook.

https://github.com/storybookjs/storybook/issues/20726

Seems like the npm config command being used (which doesn’t support workspaces) could be the cause.

https://docs.npmjs.com/cli/v9/commands/npm-config

Hey @joepetrillo! I pulled down your repository and it doesn’t reproduce for me.

That error is thrown here: https://github.com/npm/cli/blob/618c1baa830b0ab52fbee0016c3532411477bde7/lib/base-command.js#L122-L126

And the cause of that is one of the 28 commands that exist in npm that do not support workspaces. My only hypothesis is that it is possible that you have a global .npmrc that is causing this failure.

As I can’t reproduce I’m going to close this for now. Do let us all know if you get it figured out!

~/repos/triage/4183 (main)$ npm install

added 279 packages, and audited 282 packages in 6s

102 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
~/repos/triage/4183 (main *)$ npm run dev

> dev
> turbo run dev

• Packages in scope: latest, older
• Running dev in 2 packages
• Remote caching disabled
older:dev: cache bypass, force executing b28e5bb03cd06053
latest:dev: cache bypass, force executing 0bb80629ac2dae80
latest:dev: 
latest:dev: > latest@0.1.0 dev
latest:dev: > next dev
latest:dev: 
older:dev: 
older:dev: > older@0.1.0 dev
older:dev: > next dev
older:dev: 
older:dev: ready - started server on 0.0.0.0:3000, url: http://localhost:3000
latest:dev: warn  - Port 3000 is in use, trying 3001 instead.
latest:dev: ready - started server on 0.0.0.0:3001, url: http://localhost:3001
older:dev: event - compiled client and server successfully in 854 ms (165 modules)
latest:dev: event - compiled client and server successfully in 835 ms (170 modules)
older:dev: wait  - compiling / (client and server)...
older:dev: event - compiled client and server successfully in 479 ms (194 modules)
latest:dev: wait  - compiling / (client and server)...
latest:dev: event - compiled client and server successfully in 425 ms (199 modules)
^C
latest:dev:                                                                                                                                                                          
~/repos/triage/4183 (main *)$ node --version
v18.15.0
~/repos/triage/4183 (main *)$ npm --version
9.6.1
~/repos/triage/4183 (main *)$ npm run dev -- --version

> dev
> turbo run dev --version

1.8.3