How to fix "Invalid regular expression" in react-native? - react-native

E:\React-Native\reactnativeapp>npm start
I passed this command for compile my project in VS code via NPM command but last time its gave me error.
> # start E:\React-Native\reactnativeapp
> expo start
Starting project at E:\React-Native\reactnativeapp
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
error Invalid regular expression:
/(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class. Run CLI with --verbose flag for more details.
Metro Bundler process exited with code 1
Set EXPO_DEBUG=true in your env to view the stack trace.
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\Ashish\AppData\Roaming\npm-cache\_logs\2019-11-08T06_13_41_377Z-debug.log

Related

When building a project using react native as an apk in Android Studio, the following error occurs

Task :packages:react-native-codegen:android:buildCodegenCLI
react-native-codegen#0.0.7 prepublish /tmp/tmp.Yy5pPOnaYt
yarn run build
npm WARN deprecated source-map-resolve#0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-url#0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN prepublish-on-install As of npm#5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
sh: line 1: yarn: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! react-native-codegen#0.0.7 prepublish: `yarn run build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the react-native-codegen#0.0.7 prepublish 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! /home/csk882/.npm/_logs/2023-01-20T02_59_21_039Z-debug.log
> Task :packages:react-native-codegen:android:buildCodegenCLI FAILED
Execution failed for task ':packages:react-native-codegen:android:buildCodegenCLI'.
> Process 'command '/home/csk882/mt/metamask-mobile/node_modules/react-native/packages/react-native-codegen/android/../scripts/oss/build.sh'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
An error occurs when executing apk build in android studio
After building normally, the app should be deployed, but a build error occurred and it does not proceed any further.

metro boundler does not work - expo/react native

I want to run a react native app by those commands:
npm i -g expo-cli
expo init myapp
cd myapp
npm start
but I get the following error and the metro boundler not work:
Opening DevTools in the browser... (press shift-d to disable)
Error: spawn powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
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\nathan-hp\AppData\Roaming\npm-cache\_logs\2020-09-22T14_48_10_269Z-debug.log
I added this to the path:
C:\Windows\System32
but I still get the error above
ok, that was the solution:
the problem was:
Error: spawn powershell ENOENT
so I need to add:
C:\Windows\System32\WindowsPowerShell\v1.0
to the path.
I openned Windows PowerShell as admin and run:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
run npm start again in the cmd and then metro boundler was openned
I did that commands yesterday but somehow it didnt work, guess I have missed something.
The full explanation can be found here:
https://www.youtube.com/watch?reload=9&v=nfX7HtNiCZI

Npm Start: getting error while starting starting server

I'm trying to run npm server but i'm getting that error
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
Error: spawn powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
at onErrorNT (internal/child_process.js:468:16)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
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\Danger World\AppData\Roaming\npm-cache\_logs\2020-09-02T10_54_16_635Z-debug.log
Anyone can please help me
solution 1 ---
First add powershell to PATH as %SystemRoot%/system32/WindowsPowerShell/v1.0.
open powershell as admin and write this command Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force.
last thing fire npm-windows-upgrade.
solution 2 ---
Add %SystemRoot%/system32/WindowsPowerShell/v1.0 to your PATH Variable,
cmd+q and search env and hit enter
click environment variables in the advanced tab
find Path/PATH variable and click edit
Click new and paste %SystemRoot%/system32/WindowsPowerShell/v1.0
click ok and restart your terminal and try installing again

ELIFECYCLE code 2 eslint error with create-react-library

I would like to create a re-usable react component library and for boiler plate i came cross create-react-library - https://www.npmjs.com/package/create-react-library.
I followed the steps to create new library using npx command and it was successfully.
I have discovered that i was unable to run npm run test but if i run eslint . on command prompt it works fine so not sure if getting this error.
Code Editor: Visual Studio Code.
MacBook:testlib xx$ npm run test
> testlib#1.0.0 test /Users/xx/Documents/Repos/testlib
> run-s test:unit test:lint test:build
> testlib#1.0.0 test:unit /Users/xx/Documents/Repos/testlib
> cross-env CI=1 react-scripts test --env=jsdom
PASS src/index.test.tsx
ExampleComponent
✓ is truthy (6ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 5.4s
Ran all test suites.
> testlib#1.0.0 test:lint /Users/xx/Documents/Repos/testlib
> eslint .
Oops! Something went wrong! :(
ESLint: 6.8.0.
No files matching the pattern "." were found.
Please check for typing mistakes in the pattern.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! testlib#1.0.0 test:lint: `eslint .`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the testlib#1.0.0 test:lint 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/xx/.npm/_logs/2020-08-06T10_19_00_172Z-debug.log
ERROR: "test:lint" exited with 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! testlib#1.0.0 test: `run-s test:unit test:lint test:build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the testlib#1.0.0 test 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/xx/.npm/_logs/2020-08-06T10_19_00_222Z-debug.log

Nuxt.js: fsevents is not a constructor

I'm using MacOS Mojave 10.14.5. When I run 'npm run dev' command where the nuxt starter package is located, I have 'fsevents' error, and the server doesn't work.
I already reinstall node and npm several times, but it doesn't work.
Here's an error:
/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:28
return (new fsevents(path)).on('fsevent', callback).start();
^
TypeError: fsevents is not a constructor
at createFSEventsInstance (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:28:11)
at setFSEventsListener (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:82:16)
at FSWatcher.FsEventsHandler._watchWithFsEvents (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:252:16)
at FSWatcher.<anonymous> (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:386:25)
at LOOP (fs.js:1570:14)
at process._tickCallback (internal/process/next_tick.js:61:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nuxt_test_b#1.0.0 dev: `nuxt`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nuxt_test_b#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/kimgyun/.npm/_logs/2019-06-06T02_11_18_374Z-debug.log
How can I run this nuxt.js server without this error?
It's a problem with fs events, and a rather annoying one at that. Specifically this happens when you're using Node 12.
You'll need to install fsevents#1.2.9 explicitly:
npm i fsevents#1.2.9 -D
or
yarn add fsevents#1.2.9 -D
This should work for you at this point.