volta-cli / volta

Volta: JS Toolchains as Code. ⚡
https://volta.sh
Other
11.15k stars 238 forks source link

Volta error: Could not locate executable `tsc` in your project. #1571

Open YingchenWang007 opened 1 year ago

YingchenWang007 commented 1 year ago

volta list

⚡️ Currently active tools:

Node: v18.17.1 (default)
npm: v9.6.7 (default)
Yarn: v4.0.1 (default)
Tool binaries available:
     (default)
    ng (default)
    github-copilot-cli (default)
    nest (default)
    taro (current @ /Users/wangyingchen/Desktop/taroRn/package.json)
    vue (default)
     (default)
    depcheck (default)
    eas (default)
    expo, expo-cli (default)
    mirror-config-china (default)
    pnpm, pnpx (default)
    semver (default)
    tsc, tsserver (current @ /Users/wangyingchen/Desktop/taroRn/package.json)
    yrm (default)

See options for more detailed reports by running volta list --help.

tsc

Volta error: Could not locate executable tsc in your project.

taro

Volta error: Could not locate executable taro in your project.

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

chriskrycho commented 11 months ago

Hi @YingchenWang007, sorry about the delayed response here. Did you get this figured out? I have not seen a case where volta list finds a local copy of a tool in a package but is unable to run it, but that sounds like a super annoying bug.

If you are still having this issue, (a) do you have a repository we can look which it consistently reproduces with, and (b) can you confirm that you ran npm install or yarn install in the package and that it is executable at node_modules/.bin/tsc or similar?

andreeib commented 6 months ago

I had this issue as well, I was trying to run globally installed zx in a project directory that had zx in package.json without running npm install first cause it would take a long time due to huge amount of packages.

My temporary solution was to only install zx in the project: npm install --no-package-lock --no-save zx Then running zx worked.

But a better solution would be to have a flag or env variable for volta to make it use the global version of a tool: VOLTA_USE_GLOBAL=1 zx Or maybe by default if the tool is not in node_modules run the global tool.