bug: No preset version installed for command tsc
LIttleAncientForestKami opened this issue · 5 comments
Describe the Bug
asdf wants me to install nodejs that's already installed. Reshim does NOT help.
Steps to Reproduce
- npm build run # error
- npm run tsc # error
- asdf install nodejs 14.16.1 # says it's installed already
- asdf reshim # no visible output
- asdf reshim nodejs # no visible output
Steps 1 or 2 give me the error. Rest is me trying to fix, but to no avail.
Shim tsc
contents
#!/usr/bin/env bash
# asdf-plugin: nodejs 19.3.0
exec ~/.asdf/bin/asdf exec "tsc" "$@" # asdf_allow: ' asdf '
I also manually added a line # asdf-plugin: nodejs 14.16.1
and:
- that crashed the build saying no binary
- I thought reshim would help then but doing
asdf reshim nodejs
removed that line
Expected Behaviour
Build proceeding with tsc normally, since nodejs 14.16.1 is installed.
Actual Behaviour
tsc
No preset version installed for command tsc
Please install a version by running one of the following:asdf install nodejs 14.16.1
or add one of the following versions in your config file at /home/lafk/Kod/wyndham/aem_ui_cloud/.tool-versions
nodejs 19.3.0
Environment
OS:
Linux T480s 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
SHELL:
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
BASH VERSION:
5.1.16(1)-release
ASDF VERSION:
v0.12.0-816195d
ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=~/.asdf
ASDF_DIR=~/.asdf
ASDF_CONFIG_FILE=~/.asdfrc
ASDF INSTALLED PLUGINS:
nodejs https://github.com/asdf-vm/asdf-nodejs.git master c9e5df4
asdf plugins affected (if relevant)
nodejs
Version I began having this on:
$> asdf --version
v0.11.0-6a4f51a
I did asdf update
to see if it resolves the issue. It did not, as per above.
$> npm i -g tsc
~/.asdf/installs/nodejs/14.16.1/bin/tsc -> ~/.asdf/installs/nodejs/14.16.1/lib/node_modules/tsc/bin/tsc
+ tsc@2.0.4
added 1 package from 1 contributor in 0.09s
Reshimming asdf nodejs...
got me past preset and now it's saying
$> npm run tsc
> projects-shared@1.0.0 tsc ~/projects/shared/uif
> tsc
This is not the tsc command you are looking for
To get access to the TypeScript compiler, tsc, from the command line either:
- Use npm install typescript to first add TypeScript to your project before using npx
- Use yarn to avoid accidentally running code from un-installed packages
npm ERR! code ELIFECYCLE
npm ERR! errno 1
Which is peculiar. I have been running this build even yesterday and it went through without a hiccup. I'm QUITE sure Typescript is there.
EDIT: Ah. Of course. It indeed is NOT the tsc
command I was looking for. I guess I can apply to stormtroopers now.
$> npm uninstall -g tsc; npm i -g typescript
I found #928 and must say, I'm MUCH in favour. Better error message would be great to have, esp. one with a Wiki page or a GH issue link explaining the problem and some of the solutions. #914 was helpful to even make me thing of shims and re-shimming and manual edition of shim files, which led me to "no binary", which led me to installing tsc
globally for my node version (which I still can't explain how I could run without this just yesterday).
The npm
registry is a fickle beast indeed!
@LIttleAncientForestKami Are you okay with me closing this since #928 already captures your desired fix and you found a resolution to your immediate problem?
@jthegedus let me do it instead, so you don't have to open this again. And thank you again for the work on the tool. "Closing with comment" now...