When you use this plugin you must install `typescript`. error

3.7k Views Asked by At

I am using yarn 2 and react with webpack.

In my package is "typescript": ... defined. Once I start yarn start I am getting an error:

yarn workspace test start
When you use this plugin you must install `typescript`.

What is wrong? How should I fix it? Or debug it?

4

There are 4 best solutions below

0
On

I've faced the similar issue when I was upgrading webpack from 4 to 5. The problem was the version of react-dev-utils

Upgrading react-dev-utils from v10 to v12 made the issue disappear.

devDependencies {
...
 "react-dev-utils": "^12.0.1",
...
}
0
On

You can be checked the value of your plugins config about ForkTsCheckerWebpackPlugin which the param key named tsconfig.

  1. Error Message

My Error message

  1. Check [key, value] about ForkTsCheckerWebpackPlugin.

webpack.config.js plugins config

  1. Find it in your node_modules, and set debug point, run the debugger.

Debug Point

0
On

You need to take a look at your webpack.config.js where ForkTsCheckerWebpackPlugin is initialized. ForkTsCheckerWebpackPlugin needs to be able to find the tsconfig file.

  new ForkTsCheckerWebpackPlugin({
    typescript: resolve.sync('typescript', {
      basedir: paths.appNodeModules,
      tsconfig: paths.appTsConfig,
    })
  }),

In my case I'm defining paths.appNodeModules and paths.appsTsConfig in a file called paths.js.

module.exports = {
    appTsConfig: resolveApp('tsconfig.json'),
    appNodeModules: resolveApp('node_modules'),
};
0
On

I've got a similar issue and I solved it by upgrading my dependencies. You can use VS Code extension to check which dependency needs to be updated.