1

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?

testomalta
  • 49
  • 1
  • 7
  • have the same issue, but I have only for the dev-server project where I use custom webpack config.. for the main nx project it build fine – user557983 Apr 06 '21 at 19:51

4 Answers4

3

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",
...
}
1

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

Ajanyan Pradeep
  • 1,097
  • 1
  • 16
  • 26
Rain120
  • 21
  • 2
0

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'),
};
Dharman
  • 30,962
  • 25
  • 85
  • 135
0

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.