vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26.4k stars 1.84k forks source link

[turborepo] `turbo` command is not installed globally #3798

Closed thany closed 1 year ago

thany commented 1 year ago

What version of Turborepo are you using?

1.7.4

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

npm

What operating system are you using?

Windows

Describe the Bug

In the starter guide it says, at some point, to run turbo hello and turbo lint. Neither will work, because for that to work, turbo would need to be installed globally, which is not part of the starter installation. It only installs local packages, which do not yield an executable turbo command anywhere.

Expected Behavior

I would prefer if the starter pack indeed doesn't install global packages, to prevent conflicts. Instead, the starter guide should be changed to instruct running a different command, like npm run hello and npm run lint. After all, I selected npm and of course the npm command does exist.

To Reproduce

Follow the starter guide, and pick npm as package manager.

Reproduction Repo

No response

chris-olszewski commented 1 year ago

I suppose we should have a link back to the intalling turbo docs section in the starter guide.

doesn't install global packages, to prevent conflicts

Can you elaborate on this? Global turbo installs will use a local binary if one exists

thany commented 1 year ago

I suppose we should have a link back to the intalling turbo docs section in the starter guide.

Maybe also include a dropdown to indicate the choice between npm/yarn/pnpm, so that script examples can be tailored to that choice? I imagine there might be some confusing differences otherwise, especially when not installing turbo globally.

doesn't install global packages, to prevent conflicts

Can you elaborate on this? Global turbo installs will use a local binary if one exists

I'm just saying the start guide doesn't instruct global installation. And I'm assuming this is to prevent conflicts between a local install in a repo, and a global install. When the two have functional differences, one developer might see different behaviour than another, since git pull-ing the repo doesn't guarantee the version of turbo being used, to be the same among the whole team if everyone decides to globally install.

This is why I would strongly recommend never to globally install packages that are meant to be used with a specific repo. Only install global packages when you expect to use them outside a repo - svgo and npm-check-updates are two examples of that, iyam.

mehulkar commented 1 year ago

I'm just saying the start guide doesn't instruct global installation.

Feel free to leave some comments in #3833!

thany commented 1 year ago

That's a plaster fix. It's basically a disclaimer telling users "hey, these commands won't work".