Getting an error for React Native while Building Android App - react-native

I am getting following error while building Android Application. Can anyone explain why it is happening
import type {CommandT} from './commands';
^^^^
SyntaxError: Unexpected identifier
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Module._compile (E:\React_Project\OneTap\node_modules\pirates\lib\index.js:91:24)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.newLoader [as .js] (E:\React_Project\OneTap\node_modules\pirates\lib\index.js:96:7)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! OneTap#0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the OneTap#0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:

Based on this GitHub Issue it looks like this is a problem related to RN 0.56 in Windows. As a workaround I would recommend using version 0.55.4.

Related

Error: Cannot find module 'source-map-support'

Out of nowhere, my working react native app gave me this error when I opened it today. I tried npm install , yarn and cleaning the cache but nothing helped. As I said, it came out out of nowhere as everything used to work fine before that. What could be the reason for this and how can I solve it?
> expo start
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'source-map-support'
Require stack:
- C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\index.js
- C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js
- C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\index.js:4:30)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Angel\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\xdl\\build\\index.js',
'C:\\Users\\Angel\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\build\\exp.js',
'C:\\Users\\Angel\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\bin\\expo.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Angel\AppData\Roaming\npm-cache\_logs\2021-06-06T18_17_52_900Z-debug.log
After lots of hours of struggle at the end I just deleted Expo and then installed it again and it worked.

How to solve error “SyntaxError: Unexpected token” and “npm ERR! code ELIFECYCLE”

I receive the following error when I run npm start. Could anyone please help me with this issue. I encounter it only on Windows 10; everything works fine on macOS.
Here is the traceback:
$ npm start
> webpack-boilerplate#1.0.0 start E:\Projects\Upwork_Projects\wellness-osteo\markup
> webpack-dev-server --open --config webpack.dev.js
E:\Projects\Upwork_Projects\wellness-osteo\markup\node_modules\copy-webpack-plugin\node_modules\p-limit\index.js:30
} catch {}
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (E:\Projects\Upwork_Projects\wellness-osteo\markup\node_modules\copy-webpack-plugin\dist\index.js:12:38)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webpack-boilerplate#1.0.0 start: `webpack-dev-server --open --config webpack.dev.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webpack-boilerplate#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\krish\AppData\Roaming\npm-cache\_logs\2020-09-08T17_46_12_163Z-debug.log
This is because the catch statement is missing an exception variable
it should have been written as
} catch (e) { }
This has been resolved as of copy-webpack-plugin^#6.3.0
Try upgrading / downgrading to an earlier version to resolve this.
c.f try/catch block in the Javascript MDN documentation

Detox tests: SyntaxError: Missing initializer in const declaration

I am pretty new to React Native and Detox and facing some issue debugging the root cause of this issue.
Basically for our test environment we first run our docker using
npm run e2e -- --docker start
e2e script is defined in package.json as
"e2e": "ts-node e2e/runner.ts",
The error that I get is:
#cb/mobile#0.0.1 e2e /Users/rishabhharit/Documents/GitHub/clearbook/packages/cb-mobile
ts-node e2e/runner.ts "--docker" "start"
/Users/rishabhharit/Documents/GitHub/clearbook/packages/cb-mobile/node_modules/react-native/Libraries/Utilities/warnOnce.js:15
const warnedKeys: {[string]: boolean} = {};
^^^^^^^^^^
SyntaxError: Missing initializer in const declaration
at wrapSafe (internal/modules/cjs/loader.js:891:16)
at Module._compile (internal/modules/cjs/loader.js:941:27)
at Module._extensions..js (internal/modules/cjs/loader.js:1011:10)
at Object.require.extensions.<computed> [as .js] (/Users/rishabhharit/Documents/GitHub/clearbook/packages/cb-mobile/node_modules/ts-node/src/index.ts:807:44)
at Module.load (internal/modules/cjs/loader.js:822:32)
at Function.Module._load (internal/modules/cjs/loader.js:730:14)
at Module.require (internal/modules/cjs/loader.js:864:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/Users/rishabhharit/Documents/GitHub/clearbook/packages/cb-mobile/node_modules/react-native/Libraries/react-native/react-native-implementation.js:14:18)
at Module._compile (internal/modules/cjs/loader.js:971:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! #cb/mobile#0.0.1 e2e: `ts-node e2e/runner.ts "--docker" "start"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the #cb/mobile#0.0.1 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rishabhharit/.npm/_logs/2020-05-07T08_58_41_483Z-debug.log
[2020-05-07T08_58_41_483Z-debug.log](https://github.com/wix/Detox/files/4591898/2020-05-07T08_58_41_483Z-debug.log)
runner.ts.zip
Now I am unsure where to look at. Will provide more info as per request.
This answer helped me https://stackoverflow.com/a/57254546.
Just add this line to the e2e/config.json:
"preset": "react-native"

Vue - Error: Cannot find module 'webpack/bin/config-yargs'

I'm new to Vue.js.
I cloned a project from github and i tried to run it by npm run dev.
Unfortunately it gives me this kind of error
> webpack-dev-server --inline --hot --env.dev
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module 'webpack/bin/config-yargs'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\123\Desktop\python2020\Eduwonka\element-starter\node_modules\webpack-dev-server\bin\webpack-dev-server.js:54:1)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! element-starter# dev: `webpack-dev-server --inline --hot --env.dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the element-starter# dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\123\AppData\Roaming\npm-cache\_logs\2020-04-19T15_05_27_959Z-debug.log
Like i said before, I'm new to Vue and I have no idea where to start look for.
Anyone can please direct me what should i do? What am i doing wrong?
This was the solution npm install --save-dev webpack - I dont know why, but it worked

npm run dev suddenly stopped working - Nuxt js

This is my terminal log, when I try to run npm run dev
cross-env HOST=0.0.0.0 PORT=3000 nuxt
module.js:545
throw err;
^
Error: Cannot find module '..'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/MYUSER/Desktop/PROJECTFOLDER/node_modules/.bin/nuxt:9:19)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! PROJECT#1.0.0 dev: `cross-env
HOST=0.0.0.0 PORT=3000 nuxt`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the PROJECT#1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/MYUSER/.npm/_logs/2019-03-14T08_05_59_626Z-debug.log
This happened all of a sudden after 1 week working on another project.
Sorry if my tags are incorrect. Feel free to correct them. Thanks in advance.
1.delete node_modules folder
2 .delete package-lock.json
then
npm install