Module not found: Error: Can't resolve '@types/svgo'

1.3k views Asked by At

I have installed types for svgo using

yarn add @types/svgo.

In the file where I want to use svgo I write:

import SVGO from 'svgo';

From there I can comfortably inspect types by going to definition from svgo.

But when I runt yarn install or similar commands in the console I get:

ERROR in dll renderer
Module not found: Error: Can't resolve '@types/svgo' in 'C:\[projectfolder]'
 @ dll renderer renderer[2]
error Command failed with exit code 2

It is an Electron project recently started from the electron-react-boilerplate.

What might be causing this?

1

There are 1 answers

1
Dawid Laszuk On

Had the same issue. The solution is to move @types/* to devDependencies rather than keep them in dependencies in package.json.

If you have a new project then you should use yard add with --dev flag, i.e. yarn add --dev @types/svgo.