`tsc --noEmit` hangs indefinitely with `fnm`
I'm experiencing an issue where running the command tsc --noEmit hangs indefinitely and never completes. This issue occurs when using fnm version 1.37.1 with Node.js version 20.0.0.
Here's what I've tried:
- Running
tsc --noEmit --traceResolutionto gather more information.
The log output from --traceResolution shows the following (last few lines):
======== Module name '@typescript/lib-esnext/collection' was not resolved. ========
File '/home/rxtsel/.local/share/fnm/node-versions/v20.0.0/installation/lib/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/home/rxtsel/.local/share/fnm/node-versions/v20.0.0/installation/lib/node_modules/typescript/package.json' exists according to earlier cached lookups.
======== Resolving module '@typescript/lib-esnext/array' from '/home/rxtsel/Projects/sound-advice-app/__lib_node_modules_lookup_lib.esnext.array.d.ts__.ts'. ========
Explicitly specified module resolution kind: 'Node10'.
Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: TypeScript, Declaration.
Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.
Scoped package detected, looking in 'typescript__lib-esnext/array'
Directory '/home/rxtsel/Projects/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/array'
Directory '/home/rxtsel/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/array'
Directory '/home/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/array'
Directory '/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/array'
Loading module '@typescript/lib-esnext/array' from 'node_modules' folder, target file types: JavaScript.
Searching all ancestor node_modules directories for fallback extensions: JavaScript.
Directory '/home/rxtsel/Projects/node_modules' does not exist, skipping all lookups in it.
Directory '/home/rxtsel/node_modules' does not exist, skipping all lookups in it.
Directory '/home/node_modules' does not exist, skipping all lookups in it.
Directory '/node_modules' does not exist, skipping all lookups in it.
======== Module name '@typescript/lib-esnext/array' was not resolved. ========
File '/home/rxtsel/.local/share/fnm/node-versions/v20.0.0/installation/lib/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/home/rxtsel/.local/share/fnm/node-versions/v20.0.0/installation/lib/node_modules/typescript/package.json' exists according to earlier cached lookups.
======== Resolving module '@typescript/lib-esnext/regexp' from '/home/rxtsel/Projects/sound-advice-app/__lib_node_modules_lookup_lib.esnext.regexp.d.ts__.ts'. ========
Explicitly specified module resolution kind: 'Node10'.
Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: TypeScript, Declaration.
Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.
Scoped package detected, looking in 'typescript__lib-esnext/regexp'
Directory '/home/rxtsel/Projects/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/regexp'
Directory '/home/rxtsel/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/regexp'
Directory '/home/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/regexp'
Directory '/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/regexp'
Loading module '@typescript/lib-esnext/regexp' from 'node_modules' folder, target file types: JavaScript.
Searching all ancestor node_modules directories for fallback extensions: JavaScript.
Directory '/home/rxtsel/Projects/node_modules' does not exist, skipping all lookups in it.
Directory '/home/rxtsel/node_modules' does not exist, skipping all lookups in it.
Directory '/home/node_modules' does not exist, skipping all lookups in it.
Directory '/node_modules' does not exist, skipping all lookups in it.
======== Module name '@typescript/lib-esnext/regexp' was not resolved. ========
File '/home/rxtsel/.local/share/fnm/node-versions/v20.0.0/installation/lib/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/home/rxtsel/.local/share/fnm/node-versions/v20.0.0/installation/lib/node_modules/typescript/package.json' exists according to earlier cached lookups.
======== Resolving module '@typescript/lib-esnext/string' from '/home/rxtsel/Projects/sound-advice-app/__lib_node_modules_lookup_lib.esnext.string.d.ts__.ts'. ========
Explicitly specified module resolution kind: 'Node10'.
Loading module '@typescript/lib-esnext/string' from 'node_modules' folder, target file types: TypeScript, Declaration.
Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.
Scoped package detected, looking in 'typescript__lib-esnext/string'
Directory '/home/rxtsel/Projects/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/string'
Directory '/home/rxtsel/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/string'
Directory '/home/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/string'
Directory '/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'typescript__lib-esnext/string'
Loading module '@typescript/lib-esnext/string' from 'node_modules' folder, target file types: JavaScript.
Searching all ancestor node_modules directories for fallback extensions: JavaScript.
Directory '/home/rxtsel/Projects/node_modules' does not exist, skipping all lookups in it.
Directory '/home/rxtsel/node_modules' does not exist, skipping all lookups in it.
Directory '/home/node_modules' does not exist, skipping all lookups in it.
Directory '/node_modules' does not exist, skipping all lookups in it.
======== Module name '@typescript/lib-esnext/string' was not resolved. ========
File '/home/rxtsel/.local/share/fnm/node-versions/v20.0.0/installation/lib/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/home/rxtsel/.local/share/fnm/node-versions/v20.0.0/installation/lib/node_modules/typescript/package.json' exists according to earlier cached lookups.
Environment:
- OS: Arch Linux with Hyprland 6.10.2-arch1-1
- Terminal: Kitty 0.35.2
- Node.js version: 20.0.0
- npm version: 9.6.4
- fnm version: 1.37.1
- .zshrc configuration:
export ZSH="$HOME/.oh-my-zsh"
export EDITOR="nvim"
ZSH_THEME="robbyrussell"
plugins=(
sudo
git
zsh-syntax-highlighting
zsh-autosuggestions
)
source $ZSH/oh-my-zsh.sh
# Vim Keybindings
# bindkey -v
alias dot="cd ~/dot"
alias pro="cd ~/Projects"
alias zr="source ~/.zshrc"
alias v="nvim"
alias vim="nvim"
alias zz="cd ~/.config"
alias vcfg="cd ~/.config/nvim/ && nvim init.lua"
alias clean="sudo pacman -Rns \$(pacman -Qtdq) && sudo pacman -Sc && yay -Yc && sudo rm -rf ~/.cache/ || true && find ~/.cache -type f -print -delete || true && rm -rf ~/.local/share/Trash || true"
alias z="zellij"
# zed
export PATH=$PATH:~/.local/bin
# fnm
FNM_PATH="/home/rxtsel/.local/share/fnm"
if [ -d "$FNM_PATH" ]; then
export PATH="/home/rxtsel/.local/share/fnm:$PATH"
eval "`fnm env`"
eval "$(fnm env --use-on-cd --shell zsh)"
fi
Steps to Reproduce:
- Install
fnmversion 1.37.1. - Use
fnmto manage Node.js version 20.0.0. - Run
tsc --noEmitin a project directory.
Expected Behavior:
tsc --noEmit should complete successfully and exit normally.
Actual Behavior: The command hangs indefinitely and never completes.
Additional Information:
- The issue seems to occur with larger projects, but works fine with smaller projects.
- The problem does not occur with any version of Node.js installed from
fnm list-remote. - I do not have any other Node.js version managers installed on the system.
Project tsconfig.ts:
{
"compilerOptions": {
"target": "es5",
"noErrorTruncation": true,
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"tailwind.config.js"
],
"exclude": ["node_modules"]
}
I have this same issue with a nextjs app that uses prisma. if i delete the .prisma/client folder it will complete. Stil trying to figure out what is in that folder but guessing something with the prisma types is messing it up.
Update: The prisma relation seems to have been a false flag.
The error comes from in this
{...register('tag_type_id')}
something in that from react-hook-form will freeze all of typescript if, if I @ts-nocheck the page containing it all is back to expected.