Error being displayed while setting up react native development environment - react-native

After typing 'npm start' instead of getting QR code on the terminal I am getting a 'UnhandledPromiseRejectionWarning' error. Can please someone help me resolve this? I am a beginner at this so I dont know the meaning of errors being displayed
C:\Users\DELL\Desktop\project> npm run android
> project#1.0.0 android C:\Users\DELL\Desktop\project
> expo start --android
(node:3460) UnhandledPromiseRejectionWarning: Error: Cannot find module 'fs/promises'
Require stack:
- C:\Users\DELL\Desktop\project\node_modules\#expo\cli\build\src\start\doctor\typescript\TypeScriptProjectPrerequisite.js
- C:\Users\DELL\Desktop\project\node_modules\#expo\cli\build\src\start\startAsync.js
- C:\Users\DELL\Desktop\project\node_modules\#expo\cli\build\src\start\index.js
- C:\Users\DELL\Desktop\project\node_modules\#expo\cli\build\bin\cli
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:962:15)
at Function.Module._load (internal/modules/cjs/loader.js:838:27)
at Module.require (internal/modules/cjs/loader.js:1022:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\DELL\Desktop\project\node_modules\#expo\cli\build\src\start\doctor\typescript\TypeScriptProjectPrerequisite.js:5:40)
at Module._compile (internal/modules/cjs/loader.js:1118:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)
at Module.load (internal/modules/cjs/loader.js:982:32)
at Function.Module._load (internal/modules/cjs/loader.js:875:14)
at Module.require (internal/modules/cjs/loader.js:1022:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\DELL\Desktop\project\node_modules\#expo\cli\build\src\start\startAsync.js:15:38)
at Module._compile (internal/modules/cjs/loader.js:1118:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)
at Module.load (internal/modules/cjs/loader.js:982:32)
at Function.Module._load (internal/modules/cjs/loader.js:875:14)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3460) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3460) [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.
PS C:\Users\DELL\Desktop\project>

Related

Error when starting metro server in Vscode

When I try to start metro server using yarn start, this error comes:
PS C:\Users\SAMSUNG\Desktop\myApp> yarn start
yarn run v1.22.17
warning ..\..\..\package.json: No license field
$ react-native start
error Cannot read properties of undefined (reading 'split').
TypeError: Cannot read properties of undefined (reading 'split')
at toIdentifier (C:\Users\SAMSUNG\Desktop\myApp\node_modules\toidentifier\index.js:26:6)
at forEachCode (C:\Users\SAMSUNG\Desktop\myApp\node_modules\http-errors\index.js:267:16)
at Array.forEach (<anonymous>)
at populateConstructorExports (C:\Users\SAMSUNG\Desktop\myApp\node_modules\http-errors\index.js:265:9)
at Object.<anonymous> (C:\Users\SAMSUNG\Desktop\myApp\node_modules\http-errors\index.js:31:1)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
What is wrong?
PS: It was working before without any problem. I upgraded all the node modules inside project and also react-native version, and this error started to happen. I didn't do anything to node.js, it is the same as before(v16.14.0).

Any npm command returns error "Cannot find module yallist" even npm -v

(node:2564) UnhandledPromiseRejectionWarning: Error: Cannot find module 'yallist'
Require stack:
- C:\Users\23354\AppData\Roaming\npm\node_modules\npm\node_modules\lru-cache\index.js
- C:\Users\23354\AppData\Roaming\npm\node_modules\npm\node_modules\semver\classes\range.js
- C:\Users\23354\AppData\Roaming\npm\node_modules\npm\node_modules\semver\classes\comparator.js
- C:\Users\23354\AppData\Roaming\npm\node_modules\npm\node_modules\semver\index.js
- C:\Users\23354\AppData\Roaming\npm\node_modules\npm\lib\utils\unsupported.js
- C:\Users\23354\AppData\Roaming\npm\node_modules\npm\lib\cli.js
- C:\Users\23354\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (C:\Users\23354\AppData\Roaming\npm\node_modules\npm\node_modules\lru-cache\index.js:4:17)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2564) 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(). To terminate the node process
on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see
https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2564) [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.
I solved this by uninstalling node, and deleting the npm folder in the Roaming folder, then restarted the computer.
After that I installed node again. Everything is working now.
I occurred this problem while yarn build, what I have done the solve the problem are:
rm -rf node_modules
yarn install
yarn build
Btw, my node version is v14.18.1 and I have tried to remove yarn.lock but not worked.

New ReactNative App Triggers Bundler Error: error Unexpected token =

Every time I try to create a new React Native app, I receive this error in the Metro Bundler:
error Unexpected token =.
/Users/lukeschoenberger/repos/PodApp/node_modules/metro-cache/src/stores/HttpStore.js:31
static HttpError = HttpError;
^
SyntaxError: Unexpected token =
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/Users/lukeschoenberger/repos/PodApp/node_modules/metro-cache/src/stores/HttpGetStore.js:12:19)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
info Run CLI with --verbose flag for more details.
Process terminated. Press <enter> to close the window
I'm running: npx react-native run-ios.
When I create the script, I create the app, I run: npx react-native init AppName
I'm on node v14.17.1.
The startup script also says: success Successfully launched the app on the simulator
What am I doing wrong?
I had the same error because I was running on node v10.
After switching to node v14.17.5 (npm v6.14.14) via nvm, it solved the issue.
Can you verify you are really on v14.17.1?
For me, I tried using node v14.17.5 and it didn't work. I removed:
static HttpError = HttpError;
static NetworkError = NetworkError;
from node_modules/metro-config/node_modules/metro-cache/src/stores/HttpStore.js
and it worked.
Can use patch-package as well:
yarn patch-package metro-config/metro-cache

How do I get around this error while running aws-azure-login

binding.cwd();
^
Error: ENOENT: no such file or directory, uv_cwd
at Error (native)
at Object.posix.resolve (path.js:424:50)
at Function.Module._resolveLookupPaths (module.js:250:17)
at Function.Module._resolveFilename (module.js:317:31)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:26:13
at Object. (/usr/local/lib/node_modules/npm/bin/npm-cli.js:76:3)
at Module._compile (module.js:398:26)
Just found the problem, it has nothing to do with aws-zure-login. I just exited my terminal and it all worked. Looks like an npm issue

Unable to upgrade ReactNative from version 0.59.x to the latest version, 0.64.x

I am upgrading my ReactNative project to the latest ReactNative version. My project is currently using ReactNative version, 0.59.10. I am upgrading it to the version, 0.64.2.
I run the following command in the project's root directory.
npx react-native upgrade
When I run the command, I am getting the following error.
info No version passed. Fetching latest...
info Fetching diff between v0.59.10 and v0.64.2...
info Applying diff...
warn Excluding files that exist in the template, but not in your project:
error Automatically applying diff failed. We did our best to automatically upgrade as many files as possible
warn Continuing after failure. Some of the files are upgraded but you will need to deal with conflicts manually
info Installing "react-native#0.64.2" and its peer dependencies...
(node:37101) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'close' of undefined
at Object.<anonymous> (/Users/xandasupport/Desktop/Wais/pcl-app/node_modules/chalk/index.js:72:75)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at _chalk (/Users/xandasupport/Desktop/Wais/pcl-app/node_modules/#react-native-community/cli/build/cliEntry.js:22:39)
at handleError (/Users/xandasupport/Desktop/Wais/pcl-app/node_modules/#react-native-community/cli/build/cliEntry.js:106:46)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:37101) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:37101) [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.
I am using Node JS version, v12.22.1. I tried using version, 14 too. I am still getting the same error. How can I fix it?