volta-cli / volta

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

Volta CANNOT locate ng binary installed by Volta #1227

Open st-clair-clarke opened 2 years ago

st-clair-clarke commented 2 years ago

Hi, I installed @angular/cli@13.3.3 with volta. According to the docs, this should be a global install. Correct?

I use elvish shell most frequently:

Running the command volta ls gives the following result:

~/pim> volta ls
⚡️ Currently active tools:

    Node: v16.13.0 (current @ /home//pim/package.json)
    Tool binaries available:
        ng (current @ /home/stclair/__/@workspace/pim/package.json)
        nx (default)
        pnpm, pnpx (default)

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

Attempting the ng --version in elvish terminal results in the following

Volta error: Could not locate executable `ng` in your project.

Please ensure that all project dependencies are installed with `npm install` or `yarn install`
Exception: ng exited with 126
[tty 2], line 1: ng --version

Attempting the ng --version in the bash terminal results in the following

stclair@scsc:~$ ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 13.3.3
Node: 16.13.0
Package Manager: npm 8.1.0
OS: linux x64

Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1303.3 (cli-only)
@angular-devkit/core         13.3.3 (cli-only)
@angular-devkit/schematics   13.3.3 (cli-only)
@schematics/angular          13.3.3 (cli-only)

My .bashrc and .profile files DO contain the following lines:

export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"

Attempting to execute my angular application shows the error below - volta cannot locate the ng binary

Executing task: pnpm run serve:dev <

> pim@0.0.0 serve:dev /home/pim
> ng serve -c development

Volta error: Could not locate executable `ng` in your project.

Please ensure that all project dependencies are installed with `npm install` or `yarn install`
 ELIFECYCLE  Command failed with exit code 126.
The terminal process "/usr/bin/bash '-c', 'pnpm run serve:dev'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Any help is appreciated.

avioli commented 2 years ago

elvish doesn't read your bash config in .bashrc nor .profile, but will read its rc.elv file.

Make sure your $paths are set correctly: https://elv.sh/learn/tour.html#changing-path