Create-react-app: EACCES error in Termux

Created on 15 Mar 2017  路  6Comments  路  Source: facebook/create-react-app

If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.

Can you reproduce the problem with latest npm?

npm --version
3.10.10

Many errors, especially related to "missing modules", are due to npm bugs.

If you're using Windows, follow these instructions to update npm.

If you're using OS X or Linux, run this to update npm:

npm install -g npm@latest

cd your_project_directory
rm -rf node_modules
npm install

Then try to reproduce the issue again.

Can you still reproduce it?

Yes, npm --version
4.4.1

Description

What are you reporting?

Error thrown in node_modules/react-scripts/scripts/init.js 64
Error: EACCES: permission denied , link '/data/data/com.termux/files/home/projects/myapp/gitignore' -> '/data/data/com.termux/files/home/projects/myapp/.gitignore' at Error (native)

Running on an Android proot, ln is not permitted:
touch a
ln a b
ln: b: Permission denied

Expected behavior

A react app is created.

Actual behavior

An improperly initialized react app is created. npm run start fails.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven鈥檛 ejected):

[email protected]

  1. node -v:

6.10.0

  1. npm -v:

4.4.1

Then, specify:

  1. Operating system:

ChromeOS running Android's Termux

  1. Browser and version:

Chrome 57

Reproducible Demo

Install Termux on ChromeOS from Google Play Store
apt update
apt upgrade
apt install nodejs
npm install create-react-app -g
npm install -g npm@latest
mkdir projects
cd projects
create-react-app myapp <- error occurs here
cd myapp
npm run start <- fails

The same error occurs when using yarn.
npm install -g yarn
yarn --version
0.21.3

Attempting
npm install -g yarn@latest
or
yarn global add yarn

produces a broken yarn installation.

Most helpful comment

This is a late solution...
Due to Android's SELinux policies, you cannot hard link as non-root (which create-react-app attempts to do).
Make your app directory first, simlink gitignore, then create your app.

mkdir myapp
ln -s myapp/gitignore myapp/.gitignore
create-react-app myapp

All 6 comments

Can you run

sudo chown -R `whoami` /data/data/com.termux/files/home/

and then try again?

There's no sudo in Termux, but the user/group on home is the same as current user. Everything from /data/data/com.termux down is owned by u0_a78. /data/data is owned by system

If you have an android phone handy, you can reproduce it with that as well. I don't think it's chromeos specific.

https://play.google.com/store/apps/details?id=com.termux

I confirm that i have the same problem on android 7 with termux

There isn't anything we can do here. From the error message, it fails renaming a file. This is a disk permission problem. I don't know how to fix permissions on this environment so please refer to its support resources.

This is a late solution...
Due to Android's SELinux policies, you cannot hard link as non-root (which create-react-app attempts to do).
Make your app directory first, simlink gitignore, then create your app.

mkdir myapp
ln -s myapp/gitignore myapp/.gitignore
create-react-app myapp
Was this page helpful?
0 / 5 - 0 ratings

Related issues

xgqfrms-GitHub picture xgqfrms-GitHub  路  3Comments

fson picture fson  路  3Comments

Evan-GK picture Evan-GK  路  3Comments

wereHamster picture wereHamster  路  3Comments

DaveLindberg picture DaveLindberg  路  3Comments