termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.27k stars 3.06k forks source link

Permission denied #create-react-app #1899

Closed ismailnurudeen closed 5 years ago

ismailnurudeen commented 6 years ago

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.

SDRausty commented 6 years ago

@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?

ismailnurudeen commented 6 years ago

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

My android device isn't rooted.

SDRausty commented 6 years ago

@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.

fornwall commented 6 years ago

@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
ismailnurudeen commented 6 years ago

@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`

/**

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

Thanks in advance...

SDRausty commented 6 years ago

@@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?

wschenk commented 6 years ago

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.

ismailnurudeen commented 6 years ago

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

screenshot_20171225-132100

wschenk commented 6 years ago

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

ghost commented 5 years ago

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
+ create-react-app@2.1.5
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...

+ react-scripts@2.1.5
+ react@16.8.3
+ react-dom@16.8.3
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.

campbellgoe commented 5 years ago

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

Grimler91 commented 5 years ago

@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

ghost commented 5 years ago

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 commented 5 years ago

@GCDeveloper this https://stackoverflow.com/questions/54073889/why-termux-dont-permission-to-create-gitignore-file-in-create-react-app works, perfectly.

campbellgoe commented 5 years ago

@messithegoat Thanks a lot, that does work perfectly.

fahadali32 commented 4 years ago

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

Sajid1500 commented 4 years ago

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.