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

Unable to use app.getPath, fatal error. #2442

Closed
3 tasks done
codelocksdev opened this issue Aug 10, 2021 · 3 comments
Closed
3 tasks done

Unable to use app.getPath, fatal error. #2442

codelocksdev opened this issue Aug 10, 2021 · 3 comments
Labels

Comments

@codelocksdev
Copy link

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.0.0-beta.57

Electron version

13.1.2

Operating system

windows 10

Last known working Electron Forge version

No response

Expected behavior

import {remote} from 'electron';

export function Greetings() {
   console.log(remote.app.getPath('home'));
   return (
    <Container>
      <Image
        src="https://www.vectorlogo.zone/logos/reactjs/reactjs-icon.svg"
        alt="ReactJS logo"
      />
    </Container>
  )
}

Expect that the system file home path should print in the console.

### Actual behavior

App crashes on startup with this error.
```| Compiling Renderer Code
An unhandled rejection has occurred inside Forge:
[Error: EISDIR: illegal operation on a directory, read] {
  errno: -4068,
  code: 'EISDIR',
  syscall: 'read'
}

Electron Forge was terminated. Location:
{}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-react-typescript@2.0.0 start: `electron-forge start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron-react-typescript@2.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\saman\AppData\Roaming\npm-cache\_logs\2021-08-10T22_07_30_463Z-debug.log

logs:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.14.6
3 info using node@v12.18.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle electron-react-typescript@2.0.0~prestart: electron-react-typescript@2.0.0
6 info lifecycle electron-react-typescript@2.0.0~start: electron-react-typescript@2.0.0
7 verbose lifecycle electron-react-typescript@2.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle electron-react-typescript@2.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\dev\repos\electron\MyCloset\node_modules\.bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\libnvvp;C:\Program Files\Oculus\Support\oculus-runtime;C:\Python38\Scripts\;C:\Python38\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files (x86)\Common Files\Seagate\VirtualFile\;C:\Program Files (x86)\Common Files\Seagate\VirtualFile64\;C:\Program Files (x86)\Common Files\Seagate\SnapAPI\;C:\Program Files\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Gradle\gradle-6.8\bin;C:\kube;C:\Program Files\dotnet\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2021.2.0\;C:\Users\saman\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\saman\AppData\Local\Programs\Python\Python36\;C:\Users\saman\AppData\Local\Microsoft\WindowsApps;C:\ffmpeg\bin\;C:\Users\saman\AppData\Local\atom\bin;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.1.1\bin;C:\Program Files\JetBrains\PyCharm Community Edition 2020.1.2\bin;C:\Program Files\Java\jdk1.8.0_251\bin;C:\users\saman\videos\;C:\gifski-0.10.1\win;C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.4\bin;C:\Users\saman\AppData\Local\Microsoft\WindowsApps;C:\Users\saman\AppData\Roaming\npm;C:\Users\saman\AppData\Local\gitkraken\bin;C:\Users\saman\.dotnet\tools;C:\Users\saman\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\JetBrains\CLion 2021.1.3\bin
9 verbose lifecycle electron-react-typescript@2.0.0~start: CWD: D:\dev\repos\electron\MyCloset
10 silly lifecycle electron-react-typescript@2.0.0~start: Args: [ '/d /s /c', 'electron-forge start' ]
11 silly lifecycle electron-react-typescript@2.0.0~start: Returned: code: 1  signal: null
12 info lifecycle electron-react-typescript@2.0.0~start: Failed to exec start script
13 verbose stack Error: electron-react-typescript@2.0.0 start: `electron-forge start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid electron-react-typescript@2.0.0
15 verbose cwd D:\dev\repos\electron\MyCloset
16 verbose Windows_NT 10.0.19043
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.18.3
19 verbose npm  v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error electron-react-typescript@2.0.0 start: `electron-forge start`
22 error Exit status 1
23 error Failed at the electron-react-typescript@2.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Steps to reproduce

  1. clone this repo: https://github.com/diego3g/electron-typescript-react and install
  2. Edit index.tsx to be this
import { Button } from '../Button'
import { Container, Image, Text } from './styles'
import {remote} from 'electron';


export function Greetings() {
  function handleSayHello() {
    window.Main.sendMessage('Hello World');

    console.log('Message sent! Check main process log in terminal.')
  }
   console.log(remote.app.getPath('home'));


  return (
    <Container>
      <Image
        src="https://www.vectorlogo.zone/logos/reactjs/reactjs-icon.svg"
        alt="ReactJS logo"
      />
      <Text>An Electron boilerplate including TypeScript, React, Jest and ESLint.</Text>
      <Button onClick={handleSayHello}>Send message to main process</Button>
    </Container>
  )
}
 

Run the app.

Additional information

No response

@malept
Copy link
Member

malept commented Aug 10, 2021

This was fixed in beta 58 with #2330

@malept malept closed this as completed Aug 10, 2021
@malept
Copy link
Member

malept commented Aug 10, 2021

If you need more assistance, please use one of the community forums, including the Electron Discord server.

@codelocksdev
Copy link
Author

I upgraded to 6.0.0-beta.58 and still getting the exact same error.

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

No branches or pull requests

2 participants