Termux-packages: Permission denied #create-react-app

Created on 3 Dec 2017  路  17Comments  路  Source: termux/termux-packages

bash: /data/data/com.termux/files/usr/bin/create-react-app: Permission denied

I got this error when i tried to create a react app using
$ create-react-app my-app.

Please i need help on how to fix it.

nodejs question

All 17 comments

@ElNuru247 thank you for your post. A little more information is requested. Use termux-info and help us figure out what might be happening. My second question to you is simple. Did you root your precious smartphone?

Thanks for replying.
Here is the result from using termux-info
termux-info.txt

My android device isn't rooted.

@ElNuru247 This is very very good, and thanks for this information. Permission errors do arise. Why? That is a good question. Can you post some more details regarding the files we are discussing? Also, what exactly are you doing in Termux? I hope you are having a wonderful time with your computer in your cool smartphone. Use ls -al and let us know how the files and directories related to this permissions issue look. Use screenshots if you like. They are very helpful at times. To sum up:
A) file and directory information,
B) your input and output.
Both are requested also so we can continue this issue.

@ElNuru247 Could you write the output of running the below commands here:

ls -la $PREFIX/bin/create-react-app
head $PREFIX/bin/create-react-app

@frornwall here are the outputs of the commands you asked me to run

first command
$ ls -la $PREFIX/bin/create-react-app lrwxrwxrwx 1 u0_a225 u0_a225 45 Dec 3 21:55 /data/data/com.termux/files/usr/bin/create-react-app -> ../lib/node_modules/create-react-app/index.js

second command
` $ head $PREFIX/bin/create-react-app

!/data/data/com.termux/files/usr/bin/env node`

/**

  • Copyright (c) 2015-present, Facebook, Inc.
    *
  • This source code is licensed under the MIT license found in the
  • LICENSE file in the root directory of this source tree.
    */

// ~~~~~~~~~~~~~~~~

Thanks in advance...

@@ElNuru247 Thanks for sharing. Can you provide a couple of more clues for us by running these commands?

ls -al $PREFIX/lib/node_modules/create-react-app/index.js
ls -al $PREFIX/bin/node

Post the link to create-react-app so we can take a closer look at the source code too. Where did you download create-react-app from?

I'm able to get this to work. I would install

$ pkg install termux-exec proot

restart termux to get the scripts running correctly (as documented here https://wiki.termux.com/wiki/Termux-exec ) and then

$ termux-chroot
$ npm install -g create-react-app
$ create-react-app testapp

You get an error at the end saying that it can't rename "gitignore" to ".gitignore" but everything seems to work fine otherwise.

I followed the @Wschenk 's steps above and it still didn't work.
here is a screenshot of the result.

screenshot_20171225-132100

Did you try the instructions here? https://wiki.termux.com/wiki/Termux-exec That might help.

Seems create-react-app is working. With the exception of failed linking of gitignore - Android does not allow hardlinks.

[~]:$ npm install -g create-react-app
/data/data/com.termux/files/usr/bin/create-react-app -> /data/data/com.termux/files/usr/lib/node_modules/create-react-app/index.js
+ [email protected]
added 63 packages from 20 contributors in 5.709s
[~]:$ create-react-app testapp

Creating a new React app in /data/data/com.termux/files/home/testapp.

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

+ [email protected]
+ [email protected]
+ [email protected]
added 1813 packages from 717 contributors and audited 36230 packages in 113.852s
found 63 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
/data/data/com.termux/files/home/testapp/node_modules/react-scripts/scripts/init.js:153
      throw err;
      ^

Error: EACCES: permission denied, link '/data/data/com.termux/files/home/testapp/gitignore' -> '/data/data/com.termux/files/home/testapp/.gitignore'
    at Object.linkSync (fs.js:954:3)
    at tryRenameSync (/data/data/com.termux/files/home/testapp/node_modules/fs-extra/lib/move-sync/index.js:40:12)
    at Object.moveSync (/data/data/com.termux/files/home/testapp/node_modules/fs-extra/lib/move-sync/index.js:22:3)
    at module.exports (/data/data/com.termux/files/home/testapp/node_modules/react-scripts/scripts/init.js:141:8)
    at [eval]:3:14
    at Script.runInThisContext (vm.js:124:20)
    at Object.runInThisContext (vm.js:314:38)
    at Object.<anonymous> ([eval]-wrapper:9:26)
    at Module._compile (internal/modules/cjs/loader.js:738:30)
    at evalScript (internal/process/execution.js:60:25)

Aborting installation.
  node  has failed.

Deleting generated file... node_modules
Deleting generated file... package.json
Done.
[~]:$ ls testapp
README.md  gitignore  package-lock.json  public  src

Closing.

Why is this closed? How is that a solution? I cannot use create-react-app on Termux and have the same output as xeffyr.

@GCDeveloper android doesn't allow hardlinks so you need to patch create-react-app to use symlinks instead. We can't do anything about this on the termux side

It actually works, only hardlink for gitignore is not created. Thats enough to close the issue.
BTW, termux-chroot from proot package should fix hardlink problem.

@messithegoat Thanks a lot, that does work perfectly.

Hello users pleace help me can I install this at sdcard in com.termux/files

Hello users pleace help me can I install this at sdcard in com.termux/files

No, you can only use node in termux's private storage. You can't use node in sd card or internal storage.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zuccace picture Zuccace  路  3Comments

zejji picture zejji  路  4Comments

divyakutty picture divyakutty  路  3Comments

ILadis picture ILadis  路  3Comments

loveablefellow007 picture loveablefellow007  路  3Comments