Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENOENT: no such file or directory capacitor.config.json #285

Open
woutersteven opened this issue May 10, 2024 · 0 comments
Open

ENOENT: no such file or directory capacitor.config.json #285

woutersteven opened this issue May 10, 2024 · 0 comments

Comments

@woutersteven
Copy link

Describe the bug

Error, when Capacitor v5 (angular) project has capacitor.config.ts file (but not a JSON file). When running the Windows executable, or when running the command:

npx electron .\build\src\index.js

I get the error:

Error: ENOENT: no such file or directory, open 'C:\FOLDER\electron\build\src\capacitor.config.json"

This is after necessary changes were made to run everything as ESModules.

package.json

{
  "name": "name",
  "version": "1.0.0",
  "description": "An Amazing Capacitor App",
  "author": {
    "name": "",
    "email": "email@address.com"
  },
  "repository": {
    "type": "git",
    "url": ""
  },
  "type": "module",
  "license": "MIT",
  "engines": {
    "node": ">=16"
  },
  "exports": "./build/src/index.js",
  "scripts": {
    "build": "tsc",
    "electron:start-live": "node ./live-runner.cjs",
    "electron:start": "npm run build && electron --inspect=5858 ./",
    "electron:pack": "npm run build && electron-builder build --dir -c ./electron-builder.config.json",
    "electron:make": "npm run build && electron-builder build -c ./electron-builder.config.json -p always"
  },
  "dependencies": {
    "@capacitor-community/electron": "^5.0.1",
    "chokidar": "~3.6.0",
    "electron-is-dev": "~3.0.1",
    "electron-serve": "~2.0.0",
    "electron-unhandled": "~5.0.0",
    "electron-updater": "^6.2.1",
    "electron-window-state": "^5.0.3"
  },
  "devDependencies": {
    "electron": "^30.0.3",
    "electron-builder": "~24.13.3",
    "typescript": "^5.4.5"
  }
}

tsconfig.json

{
  "compileOnSave": true,
  "include": ["./src/**/*", "./capacitor.config.ts", "./capacitor.config.js"],
  "compilerOptions": {
    "outDir": "./build",
    "importHelpers": true,
    "target": "ES2017",
    "module": "Node16",
    "moduleResolution": "Node16",
    "esModuleInterop": true,
    "typeRoots": ["./node_modules/@types"],
    "allowJs": true,
    "rootDir": ".",
    "skipLibCheck": true,
  }
}

After running "electron:pack", i can see in the ./build folder that a capacitor.config.js file is present, but not the .json file.

I am guessing that the search for "capacitor.config.json" is hard-coded?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant