question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EACCES: permission denied, open 'yarn.lock'

See original GitHub issue

Describe the bug

▲ projects/play/create-react-app npx create-react-app app1

Creating a new React app in /home/vyorkin/projects/play/create-react-app/app1.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.12: The platform "linux" is incompatible with this module.
info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] Building fresh packages...
error An unexpected error occurred: "EACCES: permission denied, open '/home/vyorkin/projects/play/create-react-app/app1/yarn.lock'".
info If you think this is a bug, please open a bug report with the information provided in "/home/vyorkin/projects/play/create-react-app/app1/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template --cwd /home/vyorkin/projects/play/create-react-app/app1 has failed.

Deleting generated file... node_modules
Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.

But

yarn create react-app my-app

works.

Did you try recovering your dependencies?

Doesn’t make sense in my case / Not applicable

Which terms did you search for in User Guide?

Environment

OS: NixOS 20.03


 △ projects/play/create-react-app npx --version
6.14.7

 ▲ projects/play/create-react-app node --version
v14.7.0

Steps to reproduce

Just run the command above.

Expected behavior

Same as in README

Actual behavior

See above

Reproducible demo

See above

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
surendra246commented, Dec 2, 2020

Set permission 777 like “sudo chmod -R 777 {app directory name}”

1reaction
breakdscommented, Jun 2, 2021

I would like to reopen the issue here - IMHO the root cause is that

  1. create-react-app copies the yarn.lock from the software itself. See here.
  2. It assumes that the original yarn.lock packed with the software has the write permission - such assumption is not always true.

Besides, the above solution “Set permission 777” is never a good idea.

Would like to suggest updating the createReactApp.js script so that it set the correct permission with fs.chmodSync or something so that the copied yarn.lock will have the right write permission (See https://github.com/NixOS/nixpkgs/issues/88712#issuecomment-637045752). Not an expert in JavaScript, and there might exist better solution to actually fix the root cause.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

EACCES: permission denied on yarn install #1806 - GitHub
In my case it was sufficient to remove the node_modules & yarn.lock and run 'yarn', the permission change or sudo wasn't necessary. Could...
Read more >
yarn install: EACCES: permission denied, unlink yarn integrity
Try running sudo rm -rf /home/minnak/Darbas/market/node_modules/ and then yarn without elevated permissions.
Read more >
An unexpected error occurred: "EACCES: permission denied
The only solution I have is to delete node_modules on all packages which are part of my workspace, which gets annoying. Then I...
Read more >
How to fix EACCES errors with NPM on MacOS - WILL & SKILL
There are times when You get an ugly EACCES error message from NPM when You try to install an NPM package ... Error:...
Read more >
NPM Install - Resolving EACCES Permissions Denied
Typically when installing a new npm packages globally in your system, you will encounter an error something like Error: EACCESS permission denied something....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found