How to fix on Mac OSX EACCES: permission denied...You don't have access to this file - macos

I'm trying to make a new project with gatsby template running the command gatsby new website-public https://github.com/gatsbyjs/gatsby-starter-default in Terminal window, but I constantly getting this error:
gatsby new website-public https://github.com/gatsbyjs/gatsby-starter-default
Error: EACCES: permission denied, open '/Users/delilah/.config/gatsby/config.json'
You don't have access to this file.
at Object.openSync (node:fs:585:3)
at Object.readFileSync (node:fs:453:35)
at Ti._i.globalConfigPath.get all [as all] (/usr/local/lib/node_modules/gatsby-cli/node_modules/create-gatsby/lib/index.js:1:155965)
at new Ti._i.globalConfigPath (/usr/local/lib/node_modules/gatsby-cli/node_modules/create-gatsby/lib/index.js:1:155924)
at Ti (/usr/local/lib/node_modules/gatsby-cli/node_modules/create-gatsby/lib/index.js:1:155721)
at Object.<anonymous> (/usr/local/lib/node_modules/gatsby-cli/node_modules/create-gatsby/lib/index.js:1:486075)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
I have tried with following:
sudo chown -R whoami ~/.npm
sudo chown -R whoami
/usr/local/lib/node_modules
But nothing helps, I'm using Mac OSX.
If anyone has some idea, please share.

The error message says that /Users/delilah/.config/gatsby/config.json is the file you don't have access to, so that's the file you have to chown and/or chmod to fix, not paths you list as having tried.

Related

Cannot run Visual Studio code script via symlink

So, I built Visual Studio Code from source and intend to keep using it like that. But now everytime I want to open it I have to run a script from its directory. I made a symlink to that script in my /usr/local/bin but unfortunately when I run it it says this:
device:scripts work$ sudo code
Password:
module.js:550
throw err;
^
Error: Cannot find module './product.json'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at [eval]:1:1
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at Object.runInThisContext (vm.js:139:38)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:653:30)
at evalScript (bootstrap_node.js:479:27)
module.js:550
throw err;
^
Error: Cannot find module '/usr/local/build/lib/electron.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
/usr/local/bin/code: line 29: ./node_modules/.bin/gulp: No such file or directory
module.js:550
throw err;
^
Error: Cannot find module '/usr/local/build/lib/builtInExtensions.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
/usr/local/bin/code: line 41: ./node_modules/.bin/gulp: No such file or directory
/usr/local/bin/code: line 50: /usr/local/.build/electron/.app/Contents/MacOS/Electron: No such file or directory
/usr/local/bin/code: line 50: exec: /usr/local/.build/electron/.app/Contents/MacOS/Electron: cannot execute: No such file or directory
I perfectly understand that it cannot access some files, but I don't understand why. Are there any nuances regarding running electron apps?
Okay, guys. I think I solved this problem. When I ran code.sh via symlink it tried to find necessary files in the directories from my PATH variable. As I intended to run this script from anywhere but original folder they obviously wouldn't be found. So all I had to do was exporting original script directory to PATH.
As I didn't want to bloat my PATH I wrote a little helper script and made a symlink to it from /usr/local/bin/
Here's the code:
#!/bin/sh
export PATH=$PATH:/Users/work/Stuff/vscode/
cd /Users/work/Stuff/vscode/
./scripts/code.sh

Appcelerator Studio - not loading after upgrade

I've just upgraded to the new version of Appcelerator Studio and now when I try to start it I get an error.
When I start the app I'm asked for my email and password and after entering credentials I get the following error message:
Login Error
module.js:327
throw err;
^
Error: Cannot find module 'fstream'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/node_modules/appcelerator/node_modules/tar/lib/entry.js:14:15)
at Module._compile (module.js:387:26)
at Object.Module._extensions.js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
I've also tried downloading setup from the site and reinstalling - didn't help.
I'm running on MAC OS X.
I've had this as well, thought it was some kind of an issue at my system, but I'll report it.
You can resolve this by reinstalling the Appcelerator CLI:
sudo npm i -g appcelerator
appc use 5.2.0 --force
I tried to reinstall cli and got this:
Annas-iMac:bin annakozy$ sudo npm i -g appcelerator
Password:
npm WARN install:object-assign ENOENT: no such file or directory, rename '/usr/local/etc/lib/node_modules/appcelerator/node_modules/got/node_modules/object-assign' -> '/usr/local/etc/lib/node_modules/appcelerator/node_modules/got/node_modules/object-assign'
npm WARN install:ansi-regex ENOENT: no such file or directory, rename '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-regex' -> '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-regex'
npm WARN install:ansi-styles ENOENT: no such file or directory, rename '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-styles' -> '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-styles'
npm WARN install:supports-color ENOENT: no such file or directory, rename '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/supports-color' -> '/usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier/node_modules/supports-color' object-assign#3.0.0 node_modules/appcelerator/node_modules/got/node_modules/object-assign -> node_modules/appcelerator/node_modules/got/node_modules/object-assign ansi-regex#2.0.0 node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-regex -> node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-regex ansi-styles#2.2.0 node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-styles -> node_modules/appcelerator/node_modules/update-notifier/node_modules/ansi-styles has-ansi#2.0.0 node_modules/appcelerator/node_modules/update-notifier/node_modules/has-ansi -> node_modules/appcelerator/node_modules/update-notifier/node_modules/has-ansi strip-ansi#3.0.1 node_modules/appcelerator/node_modules/update-notifier/node_modules/strip-ansi -> node_modules/appcelerator/node_modules/update-notifier/node_modules/strip-ansi supports-color#2.0.0 node_modules/appcelerator/node_modules/update-notifier/node_modules/supports-color -> node_modules/appcelerator/node_modules/update-notifier/node_modules/supports-color chalk#1.1.1 node_modules/appcelerator/node_modules/update-notifier/node_modules/chalk -> node_modules/appcelerator/node_modules/update-notifier/node_modules/chalk - /usr/local/etc/lib/node_modules/appcelerator/node_modules/update-notifier node_modules/appcelerator/node_modules/update-notifier /usr/local/etc/lib └── (empty)
npm ERR! code 1

Use bower to install bootstrap 4

I'm trying to get into using my terminal on a mac. I installed npm sucessfully and when I type npm --version it gives me 2.14.12. With npm I installed bower and I think it worked. But I have two questions:
when I type bower -v it gives me this:
/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:56
throw err;
^
Error: EACCES: permission denied, open '/Users/philip/.config/configstore/bower- github.yml'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (evalmachine.<anonymous>:549:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:397:15)
at Object.create.all.get (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:34:29)
at Object.Configstore (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:27:44)
at readCachedConfig (/usr/local/lib/node_modules/bower/lib/config.js:19:23)
at defaultConfig (/usr/local/lib/node_modules/bower/lib/config.js:11:12)
at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/index.js:16:32)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
but when I type sudo bower -vit works and gives me 1.7.2 after I typed in my password. Why doesn't it work without sudo?
I wanted to install bootstrap 4 in a folder on my desktop so with cd I went to the directory and typed bower install bootstrap#v4.0.0-alpha.2 and it gives me this:
/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:56
throw err;
^
Error: EACCES: permission denied, open '/Users/philip/.config/configstore/bower-github.yml'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (evalmachine.<anonymous>:549:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:397:15)
at Object.create.all.get (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:34:29)
at Object.Configstore (/usr/local/lib/node_modules/bower/node_modules/configstore/index.js:27:44)
at readCachedConfig (/usr/local/lib/node_modules/bower/lib/config.js:19:23)
at defaultConfig (/usr/local/lib/node_modules/bower/lib/config.js:11:12)
at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/index.js:16:32)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
Can somebody tell me why? Thanks!
EDIT:
I'm that far now:
Philips-MacBook-Pro:test philip$ bower install bootstrap
bower bootstrap#* not-cached git://github.com/twbs/bootstrap.git#*
bower bootstrap#* resolve git://github.com/twbs/bootstrap.git#*
bower bootstrap#* ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/twbs/bootstrap.git", exit code of #69 Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Additional error details:
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
The reason you are getting the EACCESS error is without sudo is because you do not have permission to access those files.
To check the current permissions of a file/directory run:
ls -l <file or directory name>
at the terminal prompt.
You will see output similar to this:
drwxr--r-- 1 owner group...
for each listing.
The first character of that ouput represents the file type. In the example 'd' means the file listed is a directory. The second group of three characters describes the read ('r' in the example), write ('w') and execute ('x') permissions for the owner of the file.
The next three characters describe permissions for the group the file belongs to. In the example, you see 'r--'. This means the group that the file belongs to only has permission to read the file- no permission to write to (as indicated by the '-') or execute the file.
The final three characters describe the permissions for 'all users'. In the example, 'r--' indicates that all users have read-only access to the file.
This resource will help you understand *nix/OS X file permissions: http://www.comentum.com/unix-osx-permissions.html
In order to run those commands without sudo you will change the current permission settings to allow yourself read/write access to the files that are throwing EACCESS errors. This can be done through the GUI or with the chmod command at the terminal.
Running man chmod at the terminal brings up the man page (https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/chmod.1.html) for the chmod command.

React Native project initial compilation error

I created a new React Native project and ran it in Xcode. I get following error in the terminal and can't figure how to fix:
ERROR EACCES, permission denied '/Users/andrey.pokrovskiy/.babel.json'
{"errno":3,"code":"EACCES","path":"/Users/andrey.pokrovskiy/.babel.json","syscall":"open"}
Error: EACCES, permission denied '/Users/andrey.pokrovskiy/.babel.json'
at Object.fs.openSync (evalmachine.:438:18)
at Object.fs.writeFileSync (evalmachine.:977:15)
at save (/Users/andrey.pokrovskiy/Desktop/lab/NewiOsApp/node_modules/react-native/node_modules/babel-core/lib/api/register/cache.js:35:19)
at process._tickCallback (node.js:419:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:906:3
I've tried chown the file and looked for a solution but no luck.
Meanwhile Xcode throws Apple Mach-o linker error with 25 errors inside.
I never worked with Xcode so have no clue what that means.
Seemingly easy installation turned into a nightmare for me.
Any help would be appreciated!
I had met the same problem, and I fixed it by executing the following command:
sudo chmod 777 /Users/xxxx/.babel.json
and then re-init the react-native project
react-native init awesome-project

Cordova 4.3.0 - build command returns error Cannot find module 'Q'

After updating cordova to version 4.3.0 the command:
cordova build
returns the following error:
module.js:340
throw err;
^
Error: Cannot find module 'Q'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/lib/check_reqs.js:25:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
ERROR building one of the platforms: Error: /Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Volumes/CaseSensitive/ios_projects/_Tests/testGruntCordova/testGruntCordova/platforms/ios/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
I have already tried to remove and add the platform ios but nothing changes.
I have tried to run:
sudo npm install -g cordova / sudo npm install cordova
sudo npm install -g Q / sudo npm install Q
but nothing changes.
Any help?
Thank you very much
There was a bug and I have released a patch to it:
Apache Cordova ios - Git Repository
This is a bug shown on case-sensitive systems such as Unix, Linux and some OS X (if set as case-sensitive).
So far, to fix it, you have to locate those files containing a line like this:
Q = require('Q')
You can locate the files while standing on your project directory using grep:
grep -HnrI "require('Q" *;
then, use any text editor to manually change the mentioned line to:
Q = require('q')
Alternatively you can edit the related files on a more straight forward way by running the following command on your project directory:
grep -rl "require('Q" * | xargs sed -i "" "s/'Q'/'q'/g";
The single line above searches and edits the files that need the change.
Removing and then re-adding the platform again also works:
cordova platform remove ios
cordova platform add ios
Now you can cordova build ios :)
As mentioned by MeV this was a bug.

Resources