0
votes

I'm trying to create a react-native app using "react-native init" but its throwing the below error. I have created apps before but it suddenly started to throw this error when i tried to create a new app

ERROR: [Errno 2] No such file or directory: 'add'

I tried to do npm start, react-native start. and deleted the node_modules and re-installed it.

info Setting up new React Native app in /home/sagar/Desktop/rn- prac/justTesting info Adding required dependencies ERROR: [Errno 2] No such file or directory: 'add' (node:9851) UnhandledPromiseRejectionWarning: Error: Command failed: yarn add [email protected] at makeError (/home/sagar/Desktop/rn- prac/justTesting/node_modules/execa/index.js:174:9) at Promise.all.then.arr (/home/sagar/Desktop/rn- prac/justTesting/node_modules/execa/index.js:278:16) at process._tickCallback (internal/process/next_tick.js:68:7) (node:9851) UnhandledPromiseRejectionWarning: Unhandled promise rejection.

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:9851) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

error

2
please click on the error link for the imageSagar RS
package.json { "name": "justTesting", "version": "0.0.1", "private": true, "scripts": { "start": "react-native start", "test": "jest" }, "dependencies": { "react": "16.8.6", "react-native": "0.60.0" }, "devDependencies": { "@babel/core": "^7.3.3", "@babel/runtime": "^7.3.1", "@react-native-community/eslint-config": "^0.0.3", "babel-jest": "^24.1.0", "jest": "^24.1.0", "metro-react-native-babel-preset": "^0.54.1", "react-test-renderer": "16.8.6" }, "jest": { "preset": "react-native" } }Sagar RS

2 Answers

0
votes

As mentioned here

First, run sudo apt remove cmdtest before installing yarn with sudo apt install yarn or

You need to follow the installation instructions on the website https://yarnpkg.com/lang/en/docs/install/ and add a repo first. This will then include the correct yarn, and if a conflict occurs then for correcting run following command:

sudo apt-get -o Dpkg::Options::="--force-overwrite" install yarn 
0
votes

I too got a similar error with this("node_modules/execa/index.js") file. I resolved my error using the 2 commands given below

npm uninstall -g react-native-cli
yarn global add @react-native-community/cli