ENOENT: no such file or directory, open '.svgo.yml'
See original GitHub issueDescribe the bug I’m trying to use the popular https://github.com/svg/svgo but can’t due to the following error:
webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:1887 Error: ENOENT: no such file or directory, open '/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/renderer/../../.svgo.yml'
It looks like an issue related to the https://github.com/svg/svgo/issues/622 and saw some workaround where yarn clean
cause this. However, I can confirm that I don’t have any .yarnclean
in my project, nor Yarn is cleaning anything at all as I manually verified the node_modules/svgo.yml
and it exists over there.
In addition, I have also verified by creating a standard and fresh Electron project without using the electron builder and can confirm it works as expected. So, the issue most likely being somewhere in the electron builder.
To Reproduce
- Install
yarn add svgo --dev
- Import
svgo
either on thebackground.js
or in a single file Vue component. import svgo from
svgo`- To reproduce, simply just initialise the
svgo
object. console.log(new svgo)
- You should see the relevant error in the console.
Expected behavior
I expect the SVGO library works by not showing an error and the SVGO library can find the .svgo.yml
file from the node_modules
.
Screenshots
Environment (please complete the following information):
- OS and version: macOS Catalina Version 10.15.3
- node version: 13.7.0
- npm version: 6.13.6
- yarn version (if used): 1.21.1
- vue-cli-plugin-electron-builder version : 2.0.0-beta.1
- electron version: 7
- other vue plugins used: N/A
- custom config for vcp-electron-builder:
module.exports = {
pluginOptions: {
electronBuilder: {
nodeIntegration: true
}
}
};
- (if possible) link to your repo: N/A
Additional context
Add any other context about the problem here.
The SVGO file refers the .svgo.yml
file https://github.com/svg/svgo/blob/master/lib/svgo/config.js#L30 and it seems fine.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
In your reproduction instructions, you installed svgo as a devDepenecency. It has to be install as a non-dev dependency. Run
yarn remove svgo && yarn add svgo
and then try again.Thanks man, that worked now. Never realised that adding the
svgo
as adevDependencies
would be a such issue 🎉