简体   繁体   中英

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

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?

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, ie yarn add --dev @types/svgo .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM