typescript: using @nuxt/typescript-build causes dead loop (npm only)
Describe the bug
When I run nuxt app using nuxt-ts in hoisted lerna monorepo, it causes weird behavior: when I open serve address, see 5 continuous reloads and this message:

To Reproduce Steps to reproduce the behavior:
- Clone repository https://github.com/georgyfarniev/nuxt_lerna_repro
- Run
npm i && npm run bootstrap - Run
cd repro && npm run dev - Open localhost:7005
- See error described above
Expected behavior Working correctly with hoisted lerna monorepo.
Additional context Reproducible in both Windows 10 and Node 12, as well as Arch Linux with Node 12. Please pay attention to lerna.json, as hoisted mode are enabled there.
Also, it’s probably nuxt-ts issue, because everything works well with plain nuxt
This bug is a critical blocker for us, since we cannot use our applications written in nuxt+typescript using our lerna setup which is vital for us, so I will keep monitoring this issue and I’m ready to provide any possible assistance with fixing it.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 94 (32 by maintainers)
Commits related to this issue
- fix(typescript-build): wrong path for dependency (#464) resolves #145 — committed to nuxt/typescript by IGassmann 3 years ago
- fix(typescript-build): wrong path for dependency (#464) resolves #145 — committed to Geminii/typescript by IGassmann 3 years ago
@frankier @lights0123
I had the same issue (ERROR When you use this plugin you must install typescript). Was able to resolve it in
nuxt.config:I get this error:
I’m using a yarn workspace. The error occurs in the catch statement:
The variable
typescriptPathis equal to:The following change makes the build succeed:
so this module seems to be passing an object when a string is expected. However, that seems to be because the version of fork-ts-checker-webpack-plugin that yarn decided to install was version 3, even though this project asks for v5 (it installs a separate package, fork-ts-checker-webpack-plugin-v5, that does not exist on npm). This is because I had a vue-cli app in another package, which uses v3. Adding
fork-ts-checker-webpack-pluginas a dev dependency to my package fixed the issue.As this issue is really high edge case and that this module is not responsible of any dependency resolution issue, this is unfortunately not something we can fix, sorry.
Workarounds :
hoistingpackage.jsonconfiguration (https://yarnpkg.com/lang/en/docs/selective-version-resolutions/)Hi guys.
However this (seems) was an issue with webpack-dev-middleware, i apologizes for this issue. Thanks to the works of @crutch12 and @simplesmiler this should be fixed with v2.13.2 ❤️ Keeping issue open until can confirm it is gone.
@kevinmarrec @shalldie @arkhamvm @jhabdas:
I spend half of day debugging this issue, and I found that it actually a blocker for dev mode. Here is a repro: https://github.com/georgyfarniev/nuxt-typescript-deadloop (typescript branch). I made cleanest repository for reproduction possible, without using 3rd party server or anything else.
Steps to reproduce:
npm i && npm run devI can’t find exact issue, but here is a facts:
npm run purge && npm i -S nuxt && npm i -S @nuxt/typescript-build && npm ifixes the problem. Extremely weird.So I think it should be considered a blocker and should have appropriate priority. Unfortunately, we cannot use yarn as workaround, because it breaks other packages, and npm are official package manager, so it should work. Thankfully, it works (at least now) with lerna nohoist in our very specific case. It can be an npm bug as well I presume. The further investigation are beyond limits of my mind and time bandwidth.
I’m not sure if it should be duplicated to nuxtjs repo or not, I just provided you all available information and I hope it will help to solve issue.
I’m still getting the same screen as OP.
I’m on:
I’d love to help figuring this out. But I am not seeing any useful output anywhere.
Nothing in the console. Nothing useful when running with
DEBUG=*.If you can give me some pointers as to where to look for the root cause, I might be able to resolve this.
Thanks.
@kevinmarrec, but it doesn’t work even in unhoisted environments (without lerna). And it’s unclear how to solve it by specifying exact version. This is probably most typical use case for this module. Anyway, I fixed all my problems by migrating back to vue cli from nuxt and totally removing it from my project, especially because how such issues “resolved”.
@arkhamvm @shalldie @kevinmarrec: temporary workaround for this thing, add the following into lerna.json:
Don’t forget to purge all node_modules and install && bootstrap from scratch, otherwise it may fail to work.
Update: trying to patch @nuxt/loading-screen in order to get more useful debug information. Will keep you updated about progress.