skip to Main Content

I can’t make React-Native project. React throw different errors of type "no Such File or Directory". React-Native for Linux, and Android App building.

I install Recat-Native as in the guide on the official site. Next, I use the command

npx react-native init testProject

Then I get errors

For example:

✔ Downloading template
⠋ Copying template/home/pavel/.npm/_npx/7930a8670f922cdb/node_modules/graceful-fs/polyfills.js:265
        if (!chownErOk(er)) throw er
                            ^

Error: ENOENT: no such file or directory, chmod '/home/pavel/projects/REACT_NATIVE_PROJECTS/CALC/calculator/android/app/src/debug/AndroidManifest.xml'
    at Object.chmodSync (node:fs:2007:3)
    at Object.chmodSync (/home/pavel/.npm/_npx/7930a8670f922cdb/node_modules/graceful-fs/polyfills.js:263:21)
    at ReadStream.<anonymous> (/home/pavel/.npm/_npx/7930a8670f922cdb/node_modules/@react-native-community/cli/build/tools/copyFiles.js:83:19)
    at ReadStream.emit (node:events:514:28)
    at emitCloseNT (node:internal/streams/destroy:132:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:81:21) {
  errno: -2,
  syscall: 'chmod',
  code: 'ENOENT',
  path: '/home/pavel/projects/REACT_NATIVE_PROJECTS/CALC/calculator/android/app/src/debug/AndroidManifest.xml'
}

Node.js v20.5.0

How to fix this problem?

I reinstall node, reinstall npm, erase .npm user folder and install node from brew but React anyway throws an error. This error is about different files in the project.
Sometimes errors say about another file.

2

Answers


  1. I had the same problem.

    According to this GitHub issue, the root cause may lie in versioning shenanigans (specifically, prior activities with React Native of a previous version somehow blocking the init of a new version).

    The proposed way to solve it is to upgrade the React Native version of some existing project before running init again.

    The way I solved it instead, though, is by running the init with a sudo, interrupting it with CTRL+C, and trying again normally:

    sudo npx react-native@latest init ProjectName`
    
      Need to install the following packages:
      [email protected]
      Ok to proceed? (y) 
    
    // CTRL+C
    
    npx react-native@latest init ProjectName
    

    Voilà! I hope this works.

    Login or Signup to reply.
  2. sudo npx react-native@latest init ProjectName
    sudo chown -R новый_владелец:новая_группа /путь/к/директории

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search