volta icon indicating copy to clipboard operation
volta copied to clipboard

`Volta error: Could not locate executable 'blitz' in your project.` even though blitz installed globally

Open zayenz opened this issue 2 years ago • 13 comments

I can not run blitz after installing it using yarn with the above error.

I uninstalled Volta, installed Volta again, and ran

$ volta install node
success: installed and set [email protected] (with [email protected]) as default
$ volta install yarn
success: installed and set [email protected] as default
$ yarn global add blitz
yarn global v1.22.17
...
[4/4] 🔨  Building fresh packages...
success Installed "[email protected]" with binaries:
      - blitz
✨  Done in 76.55s.
$ blitz 
Volta error: Could not locate executable `blitz` in your project.

Please ensure that all project dependencies are installed with `npm install` or `yarn install`

The system is an intel mac running macOs Big Sur 11.5.2.

zayenz avatar Nov 18 '21 09:11 zayenz

Same here with the turbo command from Turborepo.

midzdotdev avatar Dec 23 '21 09:12 midzdotdev

@zayenz I believe once you use Volta, when you wanna install a global package, you should use volta install blitz instead of installing it globally via yarn or npm.

dwiyatci avatar Dec 27 '21 13:12 dwiyatci

@zayenz I think this may be a failure of our error messages. For background, the shims that Volta uses when you globally install something are context-aware. They detect when you're running in a project that depends on the same executable and use the project-local version (rather than the global version). See this blog post for some more info about how the package version is determined.

In this case, the error message is because it's trying to locate the project-local blitz executable and not finding it in node_modules. The suggested fix is to run npm install or yarn to populate the node_modules directory. If you've done that, is it possible that you're using Yarn Plug'n'Play? This is actually the main outstanding issue we have with PnP behavior, see #158

charlespierce avatar Jan 11 '22 05:01 charlespierce

I'm having the same issue with rimraf. I install it globally but when I try to run it outside any project I get a similar error.

andrei9669 avatar Jan 25 '22 07:01 andrei9669

interestingly enough, if I run just rimraf some-dir it doesn't work, but if I run volta run rimraf some-dir it works

andrei9669 avatar Jan 25 '22 07:01 andrei9669

@andrei9669 That's strange! It sounds like it may be a different issue since you're seeing failures when running outside of a project, rather than inside of one like this issue. Would you mind opening a new issue with that information and the full error message you're seeing?

charlespierce avatar Jan 25 '22 19:01 charlespierce

@charlespierce sure: https://github.com/volta-cli/volta/issues/1145

Edit: it appears to me that I didn't run volta setup and that's why I wasn't able to use those commands

andrei9669 avatar Jan 26 '22 09:01 andrei9669

Is this related to #1149? In this case, it is happening to me with typescript (global) where I'm not able to run it by using the tsc executable but it works when is called from volta run tsc

denik1981 avatar Feb 01 '22 02:02 denik1981

https://github.com/expo/expo-cli/issues/4340

wobsoriano avatar Apr 30 '22 17:04 wobsoriano

In my case, the project have pnpm in devDependencies, also restrict the installation to pnpm.

Volta will try to get locale pnpm, but it's not exist, so get this error. In this case, volta should use globally package.

Project: https://github.com/vitejs/vite

yoyo930021 avatar Aug 18 '22 08:08 yoyo930021

I have the same issue as @yoyo930021 for project formatjs: https://github.com/formatjs/formatjs/blob/main/package.json#L106

mansona avatar Sep 13 '22 14:09 mansona

Same issue. any update?

Deuscx avatar May 23 '23 23:05 Deuscx

Same issue with nx

crusoexia avatar Nov 15 '23 03:11 crusoexia