Getting EACCES: permission denied error on electronize start on MacOS #385

Closed
opened 2026-01-29 16:38:11 +00:00 by claunia · 8 comments
Owner

Originally created by @mika76 on GitHub (Sep 18, 2019).

  • Version:
  • Latest nugets: 5.22.14
  • Dot net core: 2.2.300
  • Node: 10.15.00
  • npm: 6.9.0
  • Target: MacOS

Steps to Reproduce:

  1. Follow readme and video
  2. electronize init worked fine
  3. run electronize start
electron.net git:(master) ✗ electronize start
Start Electron Desktop Application...
Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
  Restore completed in 1.68 sec for /Users/x/Documents/git/electron.net/electron.net.csproj.
  electron.net -> /Users/x/Documents/git/electron.net/bin/Debug/netcoreapp2.2/osx-x64/electron.net.dll
  electron.net -> /Users/x/Documents/git/electron.net/bin/Debug/netcoreapp2.2/osx-x64/electron.net.Views.dll
  electron.net -> /Users/x/Documents/git/electron.net/obj/Host/bin/
node_modules missing in: /Users/x/Documents/git/electron.net/obj/Host/node_modules
Start npm install...
npm WARN checkPermissions Missing write access to /Users/x/Documents/git/electron.net/obj/Host/node_modules
npm ERR! path /Users/x/Documents/git/electron.net/obj/Host/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/x/Documents/git/electron.net/obj/Host/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/Users/x/Documents/git/electron.net/obj/Host/node_modules']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/Users/x/Documents/git/electron.net/obj/Host/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path:
npm ERR!    '/Users/x/Documents/git/electron.net/obj/Host/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/x/.npm/_logs/2019-09-18T18_43_00_745Z-debug.log
ElectronHostHook handling started...
Invoke electron - in dir: /Users/x/Documents/git/electron.net/obj/Host/node_modules/.bin
bash: line 1: ./electron: No such file or directory
Originally created by @mika76 on GitHub (Sep 18, 2019). <!-- Please search existing issues to avoid creating duplicates. --> <!-- Which version of Electron.NET CLI and API are you using? --> <!-- Please always try to use latest version before report. --> * **Version**: * Latest nugets: 5.22.14 * Dot net core: 2.2.300 * Node: 10.15.00 * npm: 6.9.0 <!-- What target are you building for? --> * **Target**: MacOS <!-- Enter your issue details below this comment. --> <!-- If you want, you can donate to increase issue priority (https://donorbox.org/electron-net) --> Steps to Reproduce: 1. Follow readme and video 2. `electronize init` worked fine 3. run `electronize start` ``` electron.net git:(master) ✗ electronize start Start Electron Desktop Application... Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Core Copyright (C) Microsoft Corporation. All rights reserved. Restore completed in 1.68 sec for /Users/x/Documents/git/electron.net/electron.net.csproj. electron.net -> /Users/x/Documents/git/electron.net/bin/Debug/netcoreapp2.2/osx-x64/electron.net.dll electron.net -> /Users/x/Documents/git/electron.net/bin/Debug/netcoreapp2.2/osx-x64/electron.net.Views.dll electron.net -> /Users/x/Documents/git/electron.net/obj/Host/bin/ node_modules missing in: /Users/x/Documents/git/electron.net/obj/Host/node_modules Start npm install... npm WARN checkPermissions Missing write access to /Users/x/Documents/git/electron.net/obj/Host/node_modules npm ERR! path /Users/x/Documents/git/electron.net/obj/Host/node_modules npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/Users/x/Documents/git/electron.net/obj/Host/node_modules' npm ERR! { [Error: EACCES: permission denied, access '/Users/x/Documents/git/electron.net/obj/Host/node_modules'] npm ERR! stack: npm ERR! 'Error: EACCES: permission denied, access \'/Users/x/Documents/git/electron.net/obj/Host/node_modules\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: npm ERR! '/Users/x/Documents/git/electron.net/obj/Host/node_modules' } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator (though this is not recommended). npm ERR! A complete log of this run can be found in: npm ERR! /Users/x/.npm/_logs/2019-09-18T18_43_00_745Z-debug.log ElectronHostHook handling started... Invoke electron - in dir: /Users/x/Documents/git/electron.net/obj/Host/node_modules/.bin bash: line 1: ./electron: No such file or directory ```
claunia added the bug label 2026-01-29 16:38:11 +00:00
Author
Owner

@mika76 commented on GitHub (Sep 18, 2019):

I also tried it via sudo electronize start but it was the same...

@mika76 commented on GitHub (Sep 18, 2019): I also tried it via `sudo electronize start` but it was the same...
Author
Owner

@netpoetica commented on GitHub (Oct 8, 2019):

Hey @mika76, where did you install node & npm from? Did you use homebrew? I am concerned that maybe you have somewhere in your chain used sudo to install (maybe node/npm, maybe nvm or some version manager).

Additionally, based on this particular error, it looks like it is the dotnet-generated folders that have permissions problems. EACCES error came from obj/Host/node_modules, so either the permissions are messed up on node_modules dir, or one of the ones up the chain.

You should be able to use ls -lash on those folders and see what the actual permissions are, vs. what they should be. Maybe you will see one of them has root instead of your your username?

@netpoetica commented on GitHub (Oct 8, 2019): Hey @mika76, where did you install node & npm from? Did you use homebrew? I am concerned that maybe you have somewhere in your chain used `sudo` to install (maybe node/npm, maybe nvm or some version manager). Additionally, based on this particular error, it looks like it is the dotnet-generated folders that have permissions problems. EACCES error came from obj/Host/node_modules, so either the permissions are messed up on node_modules dir, or one of the ones up the chain. You should be able to use `ls -lash` on those folders and see what the actual permissions are, vs. what they should be. Maybe you will see one of them has `root` instead of your your username?
Author
Owner

@mika76 commented on GitHub (Oct 9, 2019):

Hey @netpoetica, thanks for taking a look.

You're right, all the folders in obj/Host/node_modules are owned by root. As for npm, I honestly don't remember - it might have been through brew.

How can I fix this? re-install node and npm manually or something?

@mika76 commented on GitHub (Oct 9, 2019): Hey @netpoetica, thanks for taking a look. You're right, all the folders in obj/Host/node_modules are owned by root. As for npm, I honestly don't remember - it might have been through brew. How can I fix this? re-install node and npm manually or something?
Author
Owner

@mika76 commented on GitHub (Oct 9, 2019):

doing a brew info npm results in

➜  node_modules git:(master) brew info npm
node: stable 12.11.1 (bottled), HEAD
Platform built on V8 to build network applications
https://nodejs.org/
/usr/local/Cellar/node/7.6.0 (3,148 files, 40MB)
  Poured from bottle on 2017-02-23 at 11:47:36
/usr/local/Cellar/node/7.7.1 (3,148 files, 40.2MB)
  Poured from bottle on 2017-03-04 at 09:07:49
/usr/local/Cellar/node/8.2.1 (4,151 files, 45.9MB)
  Poured from bottle on 2017-08-08 at 16:08:51
/usr/local/Cellar/node/9.5.0 (5,125 files, 49.7MB)
  Poured from bottle on 2018-02-08 at 15:52:54
/usr/local/Cellar/node/10.3.0 (6,793 files, 59.3MB)
  Poured from bottle on 2018-05-30 at 21:15:57
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/node.rb
==> Dependencies
Build: pkg-config ✔, python@2 ✘
Required: icu4c ✘
==> Options
--HEAD
	Install HEAD version
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Analytics
install: 307,659 (30 days), 1,023,849 (90 days), 4,132,492 (365 days)
install_on_request: 218,337 (30 days), 741,076 (90 days), 3,054,076 (365 days)
build_error: 0 (30 days)
@mika76 commented on GitHub (Oct 9, 2019): doing a `brew info npm` results in ``` ➜ node_modules git:(master) brew info npm node: stable 12.11.1 (bottled), HEAD Platform built on V8 to build network applications https://nodejs.org/ /usr/local/Cellar/node/7.6.0 (3,148 files, 40MB) Poured from bottle on 2017-02-23 at 11:47:36 /usr/local/Cellar/node/7.7.1 (3,148 files, 40.2MB) Poured from bottle on 2017-03-04 at 09:07:49 /usr/local/Cellar/node/8.2.1 (4,151 files, 45.9MB) Poured from bottle on 2017-08-08 at 16:08:51 /usr/local/Cellar/node/9.5.0 (5,125 files, 49.7MB) Poured from bottle on 2018-02-08 at 15:52:54 /usr/local/Cellar/node/10.3.0 (6,793 files, 59.3MB) Poured from bottle on 2018-05-30 at 21:15:57 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/node.rb ==> Dependencies Build: pkg-config ✔, python@2 ✘ Required: icu4c ✘ ==> Options --HEAD Install HEAD version ==> Caveats Bash completion has been installed to: /usr/local/etc/bash_completion.d ==> Analytics install: 307,659 (30 days), 1,023,849 (90 days), 4,132,492 (365 days) install_on_request: 218,337 (30 days), 741,076 (90 days), 3,054,076 (365 days) build_error: 0 (30 days) ```
Author
Owner

@netpoetica commented on GitHub (Oct 15, 2019):

It is possible that you installed homebrew using sudo, which then causes you to need to use sudo when brew installing, at which point npm thinks you're a root user or something.

In this particular case, you can just chown -R those directories to your use instead.

In the long run, I recommend uninstalling node & npm completely, maybe uninstalling homebrew even, just making sure that you don't have any of that stuff installed with sudo. You may be able to find some online resources about changing all of these permissions without re-installing, but I personally am worried you might be setting yourself up for many more similar such issues in the future.

@netpoetica commented on GitHub (Oct 15, 2019): It is possible that you installed homebrew using sudo, which then causes you to need to use sudo when brew installing, at which point npm thinks you're a root user or something. In this particular case, you can just chown -R those directories to your use instead. In the long run, I recommend uninstalling node & npm completely, maybe uninstalling homebrew even, just making sure that you don't have any of that stuff installed with sudo. You may be able to find some online resources about changing all of these permissions without re-installing, but I personally am worried you might be setting yourself up for many more similar such issues in the future.
Author
Owner

@mika76 commented on GitHub (Oct 15, 2019):

Thanks @netpoetica I'll attempt to clean it all up

@mika76 commented on GitHub (Oct 15, 2019): Thanks @netpoetica I'll attempt to clean it all up
Author
Owner

@mika76 commented on GitHub (Oct 15, 2019):

I guess this issue can be closed also, since it's something on my machine... Thanks for all your help.

@mika76 commented on GitHub (Oct 15, 2019): I guess this issue can be closed also, since it's something on my machine... Thanks for all your help.
Author
Owner

@mika76 commented on GitHub (Oct 17, 2019):

Just as an update if anybody hits the same issue a me - I used the following article to uninstall npm and install it using nvm which manages node and npm versions better than things like homebrew: https://ajaykarwal.com/uninstall-node-and-install-nvm/

Works like a dream now...

@mika76 commented on GitHub (Oct 17, 2019): Just as an update if anybody hits the same issue a me - I used the following article to uninstall npm and install it using [nvm](https://github.com/nvm-sh/nvm) which manages node and npm versions better than things like homebrew: https://ajaykarwal.com/uninstall-node-and-install-nvm/ Works like a dream now...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#385