React is a Java-Script library that makes it effortless to create interactive UIs and frameworks to build front-end applications. You can develop new features in React without rewriting the existing code. You can create simple views for different application stages, and React will effectively update and render the appropriate components as the data changes. Moreover, React can render on the server using Node alongside powering mobile apps using React Native.

One of the key reasons for React’s rise in popularity in the last few years has been the cross-platform approach to application development. And React Native is a prime example of the same. React Native was originally developed by Facebook and used by numerous others for creating web-based and mobile applications. These include well-known brands and topics like Tesla Motors, Walmart Labs, Uber, Instagram Engineering, Discord, Wix, and many more.

Popular New Releases in React

vue

react

18.0.0 (March 29, 2022)

bootstrap

4.6.1

react-native

0.68.1

create-react-app

v5.0.1

Popular Libraries in React

freeCodeCamp

by freeCodeCamp doticonjavascriptdoticon

star image 344419 doticonBSD-3-Clause

freeCodeCamp.org's open-source codebase and curriculum. Learn to code for free.

vue

by vuejs doticonjavascriptdoticon

star image 192954 doticonMIT

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

react

by facebook doticonjavascriptdoticon

star image 186685 doticonMIT

A declarative, efficient, and flexible JavaScript library for building user interfaces.

awesome

by sindresorhus doticonshelldoticon

star image 167833 doticonCC0-1.0

😎 Awesome lists about all kinds of interesting topics

bootstrap

by twbs doticonjavascriptdoticon

star image 156587 doticonMIT

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

react-native

by facebook doticonjavascriptdoticon

star image 102222 doticonNOASSERTION

A framework for building native applications using React

create-react-app

by facebook doticonjavascriptdoticon

star image 94434 doticonMIT

Set up a modern web app by running one command.

next.js

by vercel doticonjavascriptdoticon

star image 85621 doticonMIT

The React Framework

ant-design

by ant-design doticontypescriptdoticon

star image 79578 doticonMIT

An enterprise-class UI design language and React UI library

Trending New libraries in React

vite

by vitejs doticontypescriptdoticon

star image 40832 doticonMIT

Next generation frontend tooling. It's fast!

Recoil

by facebookexperimental doticonjavascriptdoticon

star image 16419 doticonMIT

Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.

type-challenges

by type-challenges doticontypescriptdoticon

star image 16090 doticonMIT

Collection of TypeScript type challenges with online judge

appsmith

by appsmithorg doticontypescriptdoticon

star image 15181 doticonApache-2.0

Low code project to build admin panels, internal tools, and dashboards. Integrates with 15+ databases and any API.

heroicons

by tailwindlabs doticonjavascriptdoticon

star image 14454 doticonMIT

A set of free MIT-licensed high-quality SVG icons for UI development.

headlessui

by tailwindlabs doticontypescriptdoticon

star image 14223 doticonMIT

Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.

remotion

by remotion-dev doticontypescriptdoticon

star image 12674 doticonNOASSERTION

🎥 Create videos programmatically in React

rustdesk

by rustdesk doticonrustdoticon

star image 11657 doticonGPL-3.0

Yet another remote desktop software

blitz

by blitz-js doticonjavascriptdoticon

star image 11217 doticonMIT

⚡️The Fullstack React Framework — built on Next.js

Top Authors in React

1

PacktPublishing

196 Libraries

star icon5151

2

microsoft

144 Libraries

star icon105804

3

jxnblk

86 Libraries

star icon21926

4

FormidableLabs

80 Libraries

star icon62151

5

mozilla

80 Libraries

star icon4882

6

react-component

76 Libraries

star icon22375

7

reactjs

76 Libraries

star icon83557

8

dabit3

74 Libraries

star icon5211

9

kentcdodds

74 Libraries

star icon33114

10

WrathChaos

68 Libraries

star icon2377

1

196 Libraries

star icon5151

2

144 Libraries

star icon105804

3

86 Libraries

star icon21926

4

80 Libraries

star icon62151

5

80 Libraries

star icon4882

6

76 Libraries

star icon22375

7

76 Libraries

star icon83557

8

74 Libraries

star icon5211

9

74 Libraries

star icon33114

10

68 Libraries

star icon2377

Trending Kits in React

No Trending Kits are available at this moment for React

Trending Discussions on React

Error while creating new React app ("You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0)")

Error message "error:0308010C:digital envelope routines::unsupported"

Cannot read properties of undefined (reading 'transformFile') at Bundler.transformFile

The unauthenticated git protocol on port 9418 is no longer supported

How to redirect in React Router v6?

Error: [PrivateRoute] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>

new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method

ESlint - Error: Must use import to load ES Module

Android app won't build -- The minCompileSdk (31) specified in a dependency's androidx.work:work-runtime:2.7.0-beta01

Error when deploying react app and it keeps sayings << Plugin "react" was conflicted between "package.json » eslint-config-react-app » >>

QUESTION

Error while creating new React app ("You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0)")

Asked 2022-Apr-04 at 11:58

I am getting this create React app error again and again even after doing the uninstall part.

npm uninstall -g create-react-app

up to date, audited 1 package in 570ms

found 0 vulnerabilities

npx create-react-app test-app

Need to install the following packages: create-react-app Ok to proceed? (y) y

You are running create-react-app 4.0.3, which is behind the latest release (5.0.0).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:

  • npm uninstall -g create-react-app
  • yarn global remove create-react-app

The latest instructions for creating a new app can be found here: https://create-react-app.dev/docs/getting-started/

1C:\>npm --version
28.3.0
3C:\>node --version
4v16.13.0
5

How can I fix this?

ANSWER

Answered 2022-Jan-01 at 22:34

You will have to clear the npx cache to make it work.

You can locate the location of the folder where create-react-app is installed using npm ls -g create-react-app.

Also, to clear the cache, refer to this answer in How can I clear the central cache for `npx`?

Source https://stackoverflow.com/questions/70358474

QUESTION

Error message "error:0308010C:digital envelope routines::unsupported"

Asked 2022-Apr-03 at 10:57

I created the default IntelliJ IDEA React project and got this:

1Error: error:0308010C:digital envelope routines::unsupported
2    at new Hash (node:internal/crypto/hash:67:19)
3    at Object.createHash (node:crypto:130:10)
4    at module.exports (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/util/createHash.js:135:53)
5    at NormalModule._initBuildHash (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:417:16)
6    at handleParseError (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:471:10)
7    at /Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:503:5
8    at /Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:358:12
9    at /Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:373:3
10    at iterateNormalLoaders (/Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
11    at iterateNormalLoaders (/Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
12/Users/user/Programming Documents/WebServer/untitled/node_modules/react-scripts/scripts/start.js:19
13  throw err;
14  ^
15

ANSWER

Answered 2021-Nov-15 at 00:32

Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported

The simplest and easiest solution to solve the above error is to downgrade Node.js to v14.18.1. And then just delete folder node_modules and try to rebuild your project and your error must be solved.

Source https://stackoverflow.com/questions/69692842

QUESTION

Cannot read properties of undefined (reading 'transformFile') at Bundler.transformFile

Asked 2022-Mar-29 at 12:36

I have updated node today and I'm getting this error:

1error: TypeError: Cannot read properties of undefined (reading 'transformFile')
2    at Bundler.transformFile (/Users/.../node_modules/metro/src/Bundler.js:48:30)
3    at runMicrotasks (<anonymous>)
4    at processTicksAndRejections (node:internal/process/task_queues:96:5)
5    at async Object.transform (/Users/.../node_modules/metro/src/lib/transformHelpers.js:101:12)
6    at async processModule (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:18)
7    at async traverseDependenciesForSingleFile (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:131:3)
8    at async Promise.all (index 0)
9    at async initialTraverseDependencies (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:114:3)
10    at async DeltaCalculator._getChangedDependencies (/Users/.../node_modules/metro/src/DeltaBundler/DeltaCalculator.js:164:25)
11    at async DeltaCalculator.getDelta (/Users/.../node_modules/metro/src/DeltaBundler/DeltaCalculator.js:94:16)
12

Other than that I haven't done anything unusual, so I'm not sure what to share. If I'm missing any info please comment and I'll add it.

While building the terminal also throws this error:

1error: TypeError: Cannot read properties of undefined (reading 'transformFile')
2    at Bundler.transformFile (/Users/.../node_modules/metro/src/Bundler.js:48:30)
3    at runMicrotasks (<anonymous>)
4    at processTicksAndRejections (node:internal/process/task_queues:96:5)
5    at async Object.transform (/Users/.../node_modules/metro/src/lib/transformHelpers.js:101:12)
6    at async processModule (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:18)
7    at async traverseDependenciesForSingleFile (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:131:3)
8    at async Promise.all (index 0)
9    at async initialTraverseDependencies (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:114:3)
10    at async DeltaCalculator._getChangedDependencies (/Users/.../node_modules/metro/src/DeltaBundler/DeltaCalculator.js:164:25)
11    at async DeltaCalculator.getDelta (/Users/.../node_modules/metro/src/DeltaBundler/DeltaCalculator.js:94:16)
12Failed to construct transformer:  Error: error:0308010C:digital envelope routines::unsupported
13    at new Hash (node:internal/crypto/hash:67:19)
14    at Object.createHash (node:crypto:130:10)
15    at stableHash (/Users/.../node_modules/metro-cache/src/stableHash.js:19:8)
16    at Object.getCacheKey (/Users/.../node_modules/metro-transform-worker/src/index.js:593:7)
17    at getTransformCacheKey (/Users/.../node_modules/metro/src/DeltaBundler/getTransformCacheKey.js:24:19)
18    at new Transformer (/Users/.../node_modules/metro/src/DeltaBundler/Transformer.js:48:9)
19    at /Users/.../node_modules/metro/src/Bundler.js:22:29
20    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
21  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
22  library: 'digital envelope routines',
23  reason: 'unsupported',
24  code: 'ERR_OSSL_EVP_UNSUPPORTED'
25}
26

My node, npx and react-native versions are:

  • node: 17.0.0
  • npx: 8.1.0
  • react-native-cli: 2.0.1

ANSWER

Answered 2021-Oct-27 at 17:19

Ran into the same issue with Node.js 17.0.0. To solve it, I downgraded to version 14.18.1, deleted node_modules and reinstalled.

Source https://stackoverflow.com/questions/69647332

QUESTION

The unauthenticated git protocol on port 9418 is no longer supported

Asked 2022-Mar-27 at 13:23

I have been using github actions for quite sometime but today my deployments started failing. Below is the error from github action logs

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7

Upon investigation, it appears that below section in my yml file is causing the issue.

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9

I have looked into this change log but can't seem to comprehend the issue.

Additional Details: Server: EC2 Instance Github actions steps:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream"  ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55

package.json file

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream"  ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  "name": "stackstream-fe",
57  "version": "1.0.0",
58  "authors": [
59    "fayyaznofal@gmail.com"
60  ],
61  "private": true,
62  "dependencies": {
63    "@fortawesome/fontawesome-svg-core": "^1.2.34",
64    "@fortawesome/free-solid-svg-icons": "^5.15.2",
65    "@fortawesome/react-fontawesome": "^0.1.14",
66    "@fullcalendar/bootstrap": "^5.5.0",
67    "@fullcalendar/core": "^5.5.0",
68    "@fullcalendar/daygrid": "^5.5.0",
69    "@fullcalendar/interaction": "^5.5.0",
70    "@fullcalendar/react": "^5.5.0",
71    "@lourenci/react-kanban": "^2.1.0",
72    "@redux-saga/simple-saga-monitor": "^1.1.2",
73    "@testing-library/jest-dom": "^5.11.9",
74    "@testing-library/react": "^11.2.3",
75    "@testing-library/user-event": "^12.6.0",
76    "@toast-ui/react-chart": "^1.0.2",
77    "@types/jest": "^26.0.14",
78    "@types/node": "^14.10.3",
79    "@types/react": "^16.9.49",
80    "@types/react-dom": "^16.9.8",
81    "@vtaits/react-color-picker": "^0.1.1",
82    "apexcharts": "^3.23.1",
83    "availity-reactstrap-validation": "^2.7.0",
84    "axios": "^0.21.1",
85    "axios-mock-adapter": "^1.19.0",
86    "axios-progress-bar": "^1.2.0",
87    "bootstrap": "^5.0.0-beta2",
88    "chart.js": "^2.9.4",
89    "chartist": "^0.11.4",
90    "classnames": "^2.2.6",
91    "components": "^0.1.0",
92    "dotenv": "^8.2.0",
93    "draft-js": "^0.11.7",
94    "echarts": "^4.9.0",
95    "echarts-for-react": "^2.0.16",
96    "firebase": "^8.2.3",
97    "google-maps-react": "^2.0.6",
98    "history": "^4.10.1",
99    "i": "^0.3.6",
100    "i18next": "^19.8.4",
101    "i18next-browser-languagedetector": "^6.0.1",
102    "jsonwebtoken": "^8.5.1",
103    "leaflet": "^1.7.1",
104    "lodash": "^4.17.21",
105    "lodash.clonedeep": "^4.5.0",
106    "lodash.get": "^4.4.2",
107    "metismenujs": "^1.2.1",
108    "mkdirp": "^1.0.4",
109    "moment": "2.29.1",
110    "moment-timezone": "^0.5.32",
111    "nouislider-react": "^3.3.9",
112    "npm": "^7.6.3",
113    "prop-types": "^15.7.2",
114    "query-string": "^6.14.0",
115    "react": "^16.13.1",
116    "react-apexcharts": "^1.3.7",
117    "react-auth-code-input": "^1.0.0",
118    "react-avatar": "^3.10.0",
119    "react-bootstrap": "^1.5.0",
120    "react-bootstrap-editable": "^0.8.2",
121    "react-bootstrap-sweetalert": "^5.2.0",
122    "react-bootstrap-table-next": "^4.0.3",
123    "react-bootstrap-table2-editor": "^1.4.0",
124    "react-bootstrap-table2-paginator": "^2.1.2",
125    "react-bootstrap-table2-toolkit": "^2.1.3",
126    "react-chartist": "^0.14.3",
127    "react-chartjs-2": "^2.11.1",
128    "react-color": "^2.19.3",
129    "react-confirm-alert": "^2.7.0",
130    "react-content-loader": "^6.0.1",
131    "react-countdown": "^2.3.1",
132    "react-countup": "^4.3.3",
133    "react-cropper": "^2.1.4",
134    "react-data-table-component": "^6.11.8",
135    "react-date-picker": "^8.0.6",
136    "react-datepicker": "^3.4.1",
137    "react-dom": "^16.13.1",
138    "react-draft-wysiwyg": "^1.14.5",
139    "react-drag-listview": "^0.1.8",
140    "react-drawer": "^1.3.4",
141    "react-dropzone": "^11.2.4",
142    "react-dual-listbox": "^2.0.0",
143    "react-facebook-login": "^4.1.1",
144    "react-flatpickr": "^3.10.6",
145    "react-google-login": "^5.2.2",
146    "react-hook-form": "^7.15.2",
147    "react-i18next": "^11.8.5",
148    "react-icons": "^4.2.0",
149    "react-image-lightbox": "^5.1.1",
150    "react-input-mask": "^2.0.4",
151    "react-jvectormap": "^0.0.16",
152    "react-leaflet": "^3.0.5",
153    "react-meta-tags": "^1.0.1",
154    "react-modal-video": "^1.2.6",
155    "react-notifications": "^1.7.2",
156    "react-number-format": "^4.7.3",
157    "react-perfect-scrollbar": "^1.5.8",
158    "react-rangeslider": "^2.2.0",
159    "react-rating": "^2.0.5",
160    "react-rating-tooltip": "^1.1.6",
161    "react-redux": "^7.2.1",
162    "react-responsive-carousel": "^3.2.11",
163    "react-router-dom": "^5.2.0",
164    "react-script": "^2.0.5",
165    "react-scripts": "3.4.3",
166    "react-select": "^4.3.1",
167    "react-sparklines": "^1.7.0",
168    "react-star-ratings": "^2.3.0",
169    "react-super-responsive-table": "^5.2.0",
170    "react-switch": "^6.0.0",
171    "react-table": "^7.6.3",
172    "react-toastify": "^7.0.3",
173    "react-toastr": "^3.0.0",
174    "react-twitter-auth": "0.0.13",
175    "reactstrap": "^8.8.1",
176    "recharts": "^2.0.8",
177    "redux": "^4.0.5",
178    "redux-saga": "^1.1.3",
179    "reselect": "^4.0.0",
180    "sass": "^1.37.5",
181    "simplebar-react": "^2.3.0",
182    "styled": "^1.0.0",
183    "styled-components": "^5.2.1",
184    "toastr": "^2.1.4",
185    "typescript": "^4.0.2",
186    "universal-cookie": "^4.0.4"
187  },
188  "devDependencies": {
189    "@typescript-eslint/eslint-plugin": "^2.27.0",
190    "@typescript-eslint/parser": "^2.27.0",
191    "@typescript-eslint/typescript-estree": "^4.15.2",
192    "eslint-config-prettier": "^6.10.1",
193    "eslint-plugin-prettier": "^3.1.2",
194    "husky": "^4.2.5",
195    "lint-staged": "^10.1.3",
196    "prettier": "^1.19.1",
197    "react-test-renderer": "^16.13.1",
198    "redux-devtools-extension": "^2.13.8",
199    "redux-mock-store": "^1.5.4"
200  },
201  "scripts": {
202    "start": "react-scripts start",
203    "build": "react-scripts build && mv build ./deploy/build",
204    "build-local": "react-scripts build",
205    "test": "react-scripts test",
206    "eject": "react-scripts eject"
207  },
208  "eslintConfig": {
209    "extends": "react-app"
210  },
211  "husky": {
212    "hooks": {
213      "pre-commit": "lint-staged"
214    }
215  },
216  "lint-staged": {
217    "*.{js,ts,tsx}": [
218      "eslint --fix"
219    ]
220  },
221  "browserslist": {
222    "production": [
223      ">0.2%",
224      "not dead",
225      "not op_mini all"
226    ],
227    "development": [
228      "last 1 chrome version",
229      "last 1 firefox version",
230      "last 1 safari version"
231    ]
232  }
233}
234

ANSWER

Answered 2022-Mar-16 at 07:01

First, this error message is indeed expected on Jan. 11th, 2022.
See "Improving Git protocol security on GitHub".

January 11, 2022 Final brownout.

This is the full brownout period where we’ll temporarily stop accepting the deprecated key and signature types, ciphers, and MACs, and the unencrypted Git protocol.
This will help clients discover any lingering use of older keys or old URLs.

Second, check your package.json dependencies for any git:// URL, as in this example, fixed in this PR.

As noted by Jörg W Mittag:

There was a 4-month warning.
The entire Internet has been moving away from unauthenticated, unencrypted protocols for a decade, it's not like this is a huge surprise.

Personally, I consider it less an "issue" and more "detecting unmaintained dependencies".

Plus, this is still only the brownout period, so the protocol will only be disabled for a short period of time, allowing developers to discover the problem.

The permanent shutdown is not until March 15th.


For GitHub Actions:

As in actions/checkout issue 14, you can add as a first step:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream"  ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  "name": "stackstream-fe",
57  "version": "1.0.0",
58  "authors": [
59    "fayyaznofal@gmail.com"
60  ],
61  "private": true,
62  "dependencies": {
63    "@fortawesome/fontawesome-svg-core": "^1.2.34",
64    "@fortawesome/free-solid-svg-icons": "^5.15.2",
65    "@fortawesome/react-fontawesome": "^0.1.14",
66    "@fullcalendar/bootstrap": "^5.5.0",
67    "@fullcalendar/core": "^5.5.0",
68    "@fullcalendar/daygrid": "^5.5.0",
69    "@fullcalendar/interaction": "^5.5.0",
70    "@fullcalendar/react": "^5.5.0",
71    "@lourenci/react-kanban": "^2.1.0",
72    "@redux-saga/simple-saga-monitor": "^1.1.2",
73    "@testing-library/jest-dom": "^5.11.9",
74    "@testing-library/react": "^11.2.3",
75    "@testing-library/user-event": "^12.6.0",
76    "@toast-ui/react-chart": "^1.0.2",
77    "@types/jest": "^26.0.14",
78    "@types/node": "^14.10.3",
79    "@types/react": "^16.9.49",
80    "@types/react-dom": "^16.9.8",
81    "@vtaits/react-color-picker": "^0.1.1",
82    "apexcharts": "^3.23.1",
83    "availity-reactstrap-validation": "^2.7.0",
84    "axios": "^0.21.1",
85    "axios-mock-adapter": "^1.19.0",
86    "axios-progress-bar": "^1.2.0",
87    "bootstrap": "^5.0.0-beta2",
88    "chart.js": "^2.9.4",
89    "chartist": "^0.11.4",
90    "classnames": "^2.2.6",
91    "components": "^0.1.0",
92    "dotenv": "^8.2.0",
93    "draft-js": "^0.11.7",
94    "echarts": "^4.9.0",
95    "echarts-for-react": "^2.0.16",
96    "firebase": "^8.2.3",
97    "google-maps-react": "^2.0.6",
98    "history": "^4.10.1",
99    "i": "^0.3.6",
100    "i18next": "^19.8.4",
101    "i18next-browser-languagedetector": "^6.0.1",
102    "jsonwebtoken": "^8.5.1",
103    "leaflet": "^1.7.1",
104    "lodash": "^4.17.21",
105    "lodash.clonedeep": "^4.5.0",
106    "lodash.get": "^4.4.2",
107    "metismenujs": "^1.2.1",
108    "mkdirp": "^1.0.4",
109    "moment": "2.29.1",
110    "moment-timezone": "^0.5.32",
111    "nouislider-react": "^3.3.9",
112    "npm": "^7.6.3",
113    "prop-types": "^15.7.2",
114    "query-string": "^6.14.0",
115    "react": "^16.13.1",
116    "react-apexcharts": "^1.3.7",
117    "react-auth-code-input": "^1.0.0",
118    "react-avatar": "^3.10.0",
119    "react-bootstrap": "^1.5.0",
120    "react-bootstrap-editable": "^0.8.2",
121    "react-bootstrap-sweetalert": "^5.2.0",
122    "react-bootstrap-table-next": "^4.0.3",
123    "react-bootstrap-table2-editor": "^1.4.0",
124    "react-bootstrap-table2-paginator": "^2.1.2",
125    "react-bootstrap-table2-toolkit": "^2.1.3",
126    "react-chartist": "^0.14.3",
127    "react-chartjs-2": "^2.11.1",
128    "react-color": "^2.19.3",
129    "react-confirm-alert": "^2.7.0",
130    "react-content-loader": "^6.0.1",
131    "react-countdown": "^2.3.1",
132    "react-countup": "^4.3.3",
133    "react-cropper": "^2.1.4",
134    "react-data-table-component": "^6.11.8",
135    "react-date-picker": "^8.0.6",
136    "react-datepicker": "^3.4.1",
137    "react-dom": "^16.13.1",
138    "react-draft-wysiwyg": "^1.14.5",
139    "react-drag-listview": "^0.1.8",
140    "react-drawer": "^1.3.4",
141    "react-dropzone": "^11.2.4",
142    "react-dual-listbox": "^2.0.0",
143    "react-facebook-login": "^4.1.1",
144    "react-flatpickr": "^3.10.6",
145    "react-google-login": "^5.2.2",
146    "react-hook-form": "^7.15.2",
147    "react-i18next": "^11.8.5",
148    "react-icons": "^4.2.0",
149    "react-image-lightbox": "^5.1.1",
150    "react-input-mask": "^2.0.4",
151    "react-jvectormap": "^0.0.16",
152    "react-leaflet": "^3.0.5",
153    "react-meta-tags": "^1.0.1",
154    "react-modal-video": "^1.2.6",
155    "react-notifications": "^1.7.2",
156    "react-number-format": "^4.7.3",
157    "react-perfect-scrollbar": "^1.5.8",
158    "react-rangeslider": "^2.2.0",
159    "react-rating": "^2.0.5",
160    "react-rating-tooltip": "^1.1.6",
161    "react-redux": "^7.2.1",
162    "react-responsive-carousel": "^3.2.11",
163    "react-router-dom": "^5.2.0",
164    "react-script": "^2.0.5",
165    "react-scripts": "3.4.3",
166    "react-select": "^4.3.1",
167    "react-sparklines": "^1.7.0",
168    "react-star-ratings": "^2.3.0",
169    "react-super-responsive-table": "^5.2.0",
170    "react-switch": "^6.0.0",
171    "react-table": "^7.6.3",
172    "react-toastify": "^7.0.3",
173    "react-toastr": "^3.0.0",
174    "react-twitter-auth": "0.0.13",
175    "reactstrap": "^8.8.1",
176    "recharts": "^2.0.8",
177    "redux": "^4.0.5",
178    "redux-saga": "^1.1.3",
179    "reselect": "^4.0.0",
180    "sass": "^1.37.5",
181    "simplebar-react": "^2.3.0",
182    "styled": "^1.0.0",
183    "styled-components": "^5.2.1",
184    "toastr": "^2.1.4",
185    "typescript": "^4.0.2",
186    "universal-cookie": "^4.0.4"
187  },
188  "devDependencies": {
189    "@typescript-eslint/eslint-plugin": "^2.27.0",
190    "@typescript-eslint/parser": "^2.27.0",
191    "@typescript-eslint/typescript-estree": "^4.15.2",
192    "eslint-config-prettier": "^6.10.1",
193    "eslint-plugin-prettier": "^3.1.2",
194    "husky": "^4.2.5",
195    "lint-staged": "^10.1.3",
196    "prettier": "^1.19.1",
197    "react-test-renderer": "^16.13.1",
198    "redux-devtools-extension": "^2.13.8",
199    "redux-mock-store": "^1.5.4"
200  },
201  "scripts": {
202    "start": "react-scripts start",
203    "build": "react-scripts build && mv build ./deploy/build",
204    "build-local": "react-scripts build",
205    "test": "react-scripts test",
206    "eject": "react-scripts eject"
207  },
208  "eslintConfig": {
209    "extends": "react-app"
210  },
211  "husky": {
212    "hooks": {
213      "pre-commit": "lint-staged"
214    }
215  },
216  "lint-staged": {
217    "*.{js,ts,tsx}": [
218      "eslint --fix"
219    ]
220  },
221  "browserslist": {
222    "production": [
223      ">0.2%",
224      "not dead",
225      "not op_mini all"
226    ],
227    "development": [
228      "last 1 chrome version",
229      "last 1 firefox version",
230      "last 1 safari version"
231    ]
232  }
233}
234    - name: Fix up git URLs
235      run: echo -e '[url "https://github.com/"]\n  insteadOf = "git://github.com/"' >> ~/.gitconfig
236

That will change any git://github.com/ into https://github.com/.

For local projects

For all your repositories, you can set:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream"  ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  "name": "stackstream-fe",
57  "version": "1.0.0",
58  "authors": [
59    "fayyaznofal@gmail.com"
60  ],
61  "private": true,
62  "dependencies": {
63    "@fortawesome/fontawesome-svg-core": "^1.2.34",
64    "@fortawesome/free-solid-svg-icons": "^5.15.2",
65    "@fortawesome/react-fontawesome": "^0.1.14",
66    "@fullcalendar/bootstrap": "^5.5.0",
67    "@fullcalendar/core": "^5.5.0",
68    "@fullcalendar/daygrid": "^5.5.0",
69    "@fullcalendar/interaction": "^5.5.0",
70    "@fullcalendar/react": "^5.5.0",
71    "@lourenci/react-kanban": "^2.1.0",
72    "@redux-saga/simple-saga-monitor": "^1.1.2",
73    "@testing-library/jest-dom": "^5.11.9",
74    "@testing-library/react": "^11.2.3",
75    "@testing-library/user-event": "^12.6.0",
76    "@toast-ui/react-chart": "^1.0.2",
77    "@types/jest": "^26.0.14",
78    "@types/node": "^14.10.3",
79    "@types/react": "^16.9.49",
80    "@types/react-dom": "^16.9.8",
81    "@vtaits/react-color-picker": "^0.1.1",
82    "apexcharts": "^3.23.1",
83    "availity-reactstrap-validation": "^2.7.0",
84    "axios": "^0.21.1",
85    "axios-mock-adapter": "^1.19.0",
86    "axios-progress-bar": "^1.2.0",
87    "bootstrap": "^5.0.0-beta2",
88    "chart.js": "^2.9.4",
89    "chartist": "^0.11.4",
90    "classnames": "^2.2.6",
91    "components": "^0.1.0",
92    "dotenv": "^8.2.0",
93    "draft-js": "^0.11.7",
94    "echarts": "^4.9.0",
95    "echarts-for-react": "^2.0.16",
96    "firebase": "^8.2.3",
97    "google-maps-react": "^2.0.6",
98    "history": "^4.10.1",
99    "i": "^0.3.6",
100    "i18next": "^19.8.4",
101    "i18next-browser-languagedetector": "^6.0.1",
102    "jsonwebtoken": "^8.5.1",
103    "leaflet": "^1.7.1",
104    "lodash": "^4.17.21",
105    "lodash.clonedeep": "^4.5.0",
106    "lodash.get": "^4.4.2",
107    "metismenujs": "^1.2.1",
108    "mkdirp": "^1.0.4",
109    "moment": "2.29.1",
110    "moment-timezone": "^0.5.32",
111    "nouislider-react": "^3.3.9",
112    "npm": "^7.6.3",
113    "prop-types": "^15.7.2",
114    "query-string": "^6.14.0",
115    "react": "^16.13.1",
116    "react-apexcharts": "^1.3.7",
117    "react-auth-code-input": "^1.0.0",
118    "react-avatar": "^3.10.0",
119    "react-bootstrap": "^1.5.0",
120    "react-bootstrap-editable": "^0.8.2",
121    "react-bootstrap-sweetalert": "^5.2.0",
122    "react-bootstrap-table-next": "^4.0.3",
123    "react-bootstrap-table2-editor": "^1.4.0",
124    "react-bootstrap-table2-paginator": "^2.1.2",
125    "react-bootstrap-table2-toolkit": "^2.1.3",
126    "react-chartist": "^0.14.3",
127    "react-chartjs-2": "^2.11.1",
128    "react-color": "^2.19.3",
129    "react-confirm-alert": "^2.7.0",
130    "react-content-loader": "^6.0.1",
131    "react-countdown": "^2.3.1",
132    "react-countup": "^4.3.3",
133    "react-cropper": "^2.1.4",
134    "react-data-table-component": "^6.11.8",
135    "react-date-picker": "^8.0.6",
136    "react-datepicker": "^3.4.1",
137    "react-dom": "^16.13.1",
138    "react-draft-wysiwyg": "^1.14.5",
139    "react-drag-listview": "^0.1.8",
140    "react-drawer": "^1.3.4",
141    "react-dropzone": "^11.2.4",
142    "react-dual-listbox": "^2.0.0",
143    "react-facebook-login": "^4.1.1",
144    "react-flatpickr": "^3.10.6",
145    "react-google-login": "^5.2.2",
146    "react-hook-form": "^7.15.2",
147    "react-i18next": "^11.8.5",
148    "react-icons": "^4.2.0",
149    "react-image-lightbox": "^5.1.1",
150    "react-input-mask": "^2.0.4",
151    "react-jvectormap": "^0.0.16",
152    "react-leaflet": "^3.0.5",
153    "react-meta-tags": "^1.0.1",
154    "react-modal-video": "^1.2.6",
155    "react-notifications": "^1.7.2",
156    "react-number-format": "^4.7.3",
157    "react-perfect-scrollbar": "^1.5.8",
158    "react-rangeslider": "^2.2.0",
159    "react-rating": "^2.0.5",
160    "react-rating-tooltip": "^1.1.6",
161    "react-redux": "^7.2.1",
162    "react-responsive-carousel": "^3.2.11",
163    "react-router-dom": "^5.2.0",
164    "react-script": "^2.0.5",
165    "react-scripts": "3.4.3",
166    "react-select": "^4.3.1",
167    "react-sparklines": "^1.7.0",
168    "react-star-ratings": "^2.3.0",
169    "react-super-responsive-table": "^5.2.0",
170    "react-switch": "^6.0.0",
171    "react-table": "^7.6.3",
172    "react-toastify": "^7.0.3",
173    "react-toastr": "^3.0.0",
174    "react-twitter-auth": "0.0.13",
175    "reactstrap": "^8.8.1",
176    "recharts": "^2.0.8",
177    "redux": "^4.0.5",
178    "redux-saga": "^1.1.3",
179    "reselect": "^4.0.0",
180    "sass": "^1.37.5",
181    "simplebar-react": "^2.3.0",
182    "styled": "^1.0.0",
183    "styled-components": "^5.2.1",
184    "toastr": "^2.1.4",
185    "typescript": "^4.0.2",
186    "universal-cookie": "^4.0.4"
187  },
188  "devDependencies": {
189    "@typescript-eslint/eslint-plugin": "^2.27.0",
190    "@typescript-eslint/parser": "^2.27.0",
191    "@typescript-eslint/typescript-estree": "^4.15.2",
192    "eslint-config-prettier": "^6.10.1",
193    "eslint-plugin-prettier": "^3.1.2",
194    "husky": "^4.2.5",
195    "lint-staged": "^10.1.3",
196    "prettier": "^1.19.1",
197    "react-test-renderer": "^16.13.1",
198    "redux-devtools-extension": "^2.13.8",
199    "redux-mock-store": "^1.5.4"
200  },
201  "scripts": {
202    "start": "react-scripts start",
203    "build": "react-scripts build && mv build ./deploy/build",
204    "build-local": "react-scripts build",
205    "test": "react-scripts test",
206    "eject": "react-scripts eject"
207  },
208  "eslintConfig": {
209    "extends": "react-app"
210  },
211  "husky": {
212    "hooks": {
213      "pre-commit": "lint-staged"
214    }
215  },
216  "lint-staged": {
217    "*.{js,ts,tsx}": [
218      "eslint --fix"
219    ]
220  },
221  "browserslist": {
222    "production": [
223      ">0.2%",
224      "not dead",
225      "not op_mini all"
226    ],
227    "development": [
228      "last 1 chrome version",
229      "last 1 firefox version",
230      "last 1 safari version"
231    ]
232  }
233}
234    - name: Fix up git URLs
235      run: echo -e '[url "https://github.com/"]\n  insteadOf = "git://github.com/"' >> ~/.gitconfig
236git config --global url."https://github.com/".insteadOf git://github.com/
237

You can also use SSH, but GitHub Security reminds us that, as of March 15th, 2022, GitHub stopped accepting DSA keys. RSA keys uploaded after Nov 2, 2021 will work only with SHA-2 signatures.
The deprecated MACs, ciphers, and unencrypted Git protocol are permanently disabled.

So this (with the right key) would work:

1Command: git
2Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
3Directory: /home/runner/work/stackstream-fe/stackstream-fe
4Output:
5fatal: remote error: 
6  The unauthenticated git protocol on port 9418 is no longer supported.
7    - name: Installing modules
8      run: yarn install
9  steps:
10  - name: Checkout
11    uses: actions/checkout@v2
12
13  - id: vars
14    run: |
15      if [ '${{ github.ref }}' == 'refs/heads/master' ]; then echo "::set-output name=environment::prod_stackstream" ; echo "::set-output name=api-url::api" ; elif [ '${{ github.ref }}' == 'refs/heads/staging' ]; then echo "::set-output name=environment::staging_stackstream"  ; echo "::set-output name=api-url::stagingapi" ; else echo "::set-output name=environment::dev_stackstream" ; echo "::set-output name=api-url::devapi" ; fi
16
17  - uses: pCYSl5EDgo/cat@master
18    id: slack
19    with:
20      path: .github/workflows/slack.txt
21
22  - name: Slack Start Notification
23    uses: 8398a7/action-slack@v3
24    env:
25      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26      ENVIRONMENT: '`${{ steps.vars.outputs.environment }}`'
27      COLOR: good
28      STATUS: '`Started`'
29    with:
30      status: custom
31      fields: workflow,job,commit,repo,ref,author,took
32      custom_payload: |
33        ${{ steps.slack.outputs.text }}
34
35  - name: Installing modules
36    env:
37      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
38    run: yarn install
39
40  - name: Create Frontend Build
41    env:
42      REACT_APP_API_URL: 'https://${{ steps.vars.outputs.api-url }}mergestack.com/api/v1'
43    run: yarn build
44
45  - name: Deploy to Frontend Server DEV
46    if: ${{ contains(github.ref, 'dev') }}
47    uses: easingthemes/ssh-deploy@v2.1.5
48    env:
49      SSH_PRIVATE_KEY: ${{ secrets.DEV_KEY }}
50      ARGS: '-rltgoDzvO --delete'
51      SOURCE: 'deploy/'
52      REMOTE_HOST: ${{ secrets.DEV_HOST }}
53      REMOTE_USER: plyfolio-dev
54      TARGET: '/home/plyfolio-dev/${{ steps.vars.outputs.environment }}/fe/deploy'
55   {
56  "name": "stackstream-fe",
57  "version": "1.0.0",
58  "authors": [
59    "fayyaznofal@gmail.com"
60  ],
61  "private": true,
62  "dependencies": {
63    "@fortawesome/fontawesome-svg-core": "^1.2.34",
64    "@fortawesome/free-solid-svg-icons": "^5.15.2",
65    "@fortawesome/react-fontawesome": "^0.1.14",
66    "@fullcalendar/bootstrap": "^5.5.0",
67    "@fullcalendar/core": "^5.5.0",
68    "@fullcalendar/daygrid": "^5.5.0",
69    "@fullcalendar/interaction": "^5.5.0",
70    "@fullcalendar/react": "^5.5.0",
71    "@lourenci/react-kanban": "^2.1.0",
72    "@redux-saga/simple-saga-monitor": "^1.1.2",
73    "@testing-library/jest-dom": "^5.11.9",
74    "@testing-library/react": "^11.2.3",
75    "@testing-library/user-event": "^12.6.0",
76    "@toast-ui/react-chart": "^1.0.2",
77    "@types/jest": "^26.0.14",
78    "@types/node": "^14.10.3",
79    "@types/react": "^16.9.49",
80    "@types/react-dom": "^16.9.8",
81    "@vtaits/react-color-picker": "^0.1.1",
82    "apexcharts": "^3.23.1",
83    "availity-reactstrap-validation": "^2.7.0",
84    "axios": "^0.21.1",
85    "axios-mock-adapter": "^1.19.0",
86    "axios-progress-bar": "^1.2.0",
87    "bootstrap": "^5.0.0-beta2",
88    "chart.js": "^2.9.4",
89    "chartist": "^0.11.4",
90    "classnames": "^2.2.6",
91    "components": "^0.1.0",
92    "dotenv": "^8.2.0",
93    "draft-js": "^0.11.7",
94    "echarts": "^4.9.0",
95    "echarts-for-react": "^2.0.16",
96    "firebase": "^8.2.3",
97    "google-maps-react": "^2.0.6",
98    "history": "^4.10.1",
99    "i": "^0.3.6",
100    "i18next": "^19.8.4",
101    "i18next-browser-languagedetector": "^6.0.1",
102    "jsonwebtoken": "^8.5.1",
103    "leaflet": "^1.7.1",
104    "lodash": "^4.17.21",
105    "lodash.clonedeep": "^4.5.0",
106    "lodash.get": "^4.4.2",
107    "metismenujs": "^1.2.1",
108    "mkdirp": "^1.0.4",
109    "moment": "2.29.1",
110    "moment-timezone": "^0.5.32",
111    "nouislider-react": "^3.3.9",
112    "npm": "^7.6.3",
113    "prop-types": "^15.7.2",
114    "query-string": "^6.14.0",
115    "react": "^16.13.1",
116    "react-apexcharts": "^1.3.7",
117    "react-auth-code-input": "^1.0.0",
118    "react-avatar": "^3.10.0",
119    "react-bootstrap": "^1.5.0",
120    "react-bootstrap-editable": "^0.8.2",
121    "react-bootstrap-sweetalert": "^5.2.0",
122    "react-bootstrap-table-next": "^4.0.3",
123    "react-bootstrap-table2-editor": "^1.4.0",
124    "react-bootstrap-table2-paginator": "^2.1.2",
125    "react-bootstrap-table2-toolkit": "^2.1.3",
126    "react-chartist": "^0.14.3",
127    "react-chartjs-2": "^2.11.1",
128    "react-color": "^2.19.3",
129    "react-confirm-alert": "^2.7.0",
130    "react-content-loader": "^6.0.1",
131    "react-countdown": "^2.3.1",
132    "react-countup": "^4.3.3",
133    "react-cropper": "^2.1.4",
134    "react-data-table-component": "^6.11.8",
135    "react-date-picker": "^8.0.6",
136    "react-datepicker": "^3.4.1",
137    "react-dom": "^16.13.1",
138    "react-draft-wysiwyg": "^1.14.5",
139    "react-drag-listview": "^0.1.8",
140    "react-drawer": "^1.3.4",
141    "react-dropzone": "^11.2.4",
142    "react-dual-listbox": "^2.0.0",
143    "react-facebook-login": "^4.1.1",
144    "react-flatpickr": "^3.10.6",
145    "react-google-login": "^5.2.2",
146    "react-hook-form": "^7.15.2",
147    "react-i18next": "^11.8.5",
148    "react-icons": "^4.2.0",
149    "react-image-lightbox": "^5.1.1",
150    "react-input-mask": "^2.0.4",
151    "react-jvectormap": "^0.0.16",
152    "react-leaflet": "^3.0.5",
153    "react-meta-tags": "^1.0.1",
154    "react-modal-video": "^1.2.6",
155    "react-notifications": "^1.7.2",
156    "react-number-format": "^4.7.3",
157    "react-perfect-scrollbar": "^1.5.8",
158    "react-rangeslider": "^2.2.0",
159    "react-rating": "^2.0.5",
160    "react-rating-tooltip": "^1.1.6",
161    "react-redux": "^7.2.1",
162    "react-responsive-carousel": "^3.2.11",
163    "react-router-dom": "^5.2.0",
164    "react-script": "^2.0.5",
165    "react-scripts": "3.4.3",
166    "react-select": "^4.3.1",
167    "react-sparklines": "^1.7.0",
168    "react-star-ratings": "^2.3.0",
169    "react-super-responsive-table": "^5.2.0",
170    "react-switch": "^6.0.0",
171    "react-table": "^7.6.3",
172    "react-toastify": "^7.0.3",
173    "react-toastr": "^3.0.0",
174    "react-twitter-auth": "0.0.13",
175    "reactstrap": "^8.8.1",
176    "recharts": "^2.0.8",
177    "redux": "^4.0.5",
178    "redux-saga": "^1.1.3",
179    "reselect": "^4.0.0",
180    "sass": "^1.37.5",
181    "simplebar-react": "^2.3.0",
182    "styled": "^1.0.0",
183    "styled-components": "^5.2.1",
184    "toastr": "^2.1.4",
185    "typescript": "^4.0.2",
186    "universal-cookie": "^4.0.4"
187  },
188  "devDependencies": {
189    "@typescript-eslint/eslint-plugin": "^2.27.0",
190    "@typescript-eslint/parser": "^2.27.0",
191    "@typescript-eslint/typescript-estree": "^4.15.2",
192    "eslint-config-prettier": "^6.10.1",
193    "eslint-plugin-prettier": "^3.1.2",
194    "husky": "^4.2.5",
195    "lint-staged": "^10.1.3",
196    "prettier": "^1.19.1",
197    "react-test-renderer": "^16.13.1",
198    "redux-devtools-extension": "^2.13.8",
199    "redux-mock-store": "^1.5.4"
200  },
201  "scripts": {
202    "start": "react-scripts start",
203    "build": "react-scripts build && mv build ./deploy/build",
204    "build-local": "react-scripts build",
205    "test": "react-scripts test",
206    "eject": "react-scripts eject"
207  },
208  "eslintConfig": {
209    "extends": "react-app"
210  },
211  "husky": {
212    "hooks": {
213      "pre-commit": "lint-staged"
214    }
215  },
216  "lint-staged": {
217    "*.{js,ts,tsx}": [
218      "eslint --fix"
219    ]
220  },
221  "browserslist": {
222    "production": [
223      ">0.2%",
224      "not dead",
225      "not op_mini all"
226    ],
227    "development": [
228      "last 1 chrome version",
229      "last 1 firefox version",
230      "last 1 safari version"
231    ]
232  }
233}
234    - name: Fix up git URLs
235      run: echo -e '[url "https://github.com/"]\n  insteadOf = "git://github.com/"' >> ~/.gitconfig
236git config --global url."https://github.com/".insteadOf git://github.com/
237git config --global url."git@github.com:".insteadOf git://github.com/
238

That will change any git://github.com/ (unencrypted Git protocol) into git@github.com: (SSH URL).

Source https://stackoverflow.com/questions/70663523

QUESTION

How to redirect in React Router v6?

Asked 2022-Mar-24 at 17:22

I am trying to upgrade to React Router v6 (react-router-dom 6.0.1).

Here is my updated code:

1import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
2
3<BrowserRouter>
4  <Routes>
5    <Route path="/" element={<Home />} />
6    <Route path="/lab" element={<Lab />} />
7    <Route render={() => <Navigate to="/" />} />
8  </Routes>
9</BrowserRouter>
10

The last Route is redirecting the rest of paths to /.

However, I got an error

TS2322: Type '{ render: () => Element; }' is not assignable to type 'IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)'.   Property 'render' does not exist on type 'IntrinsicAttributes & (PathRouteProps | LayoutRouteProps | IndexRouteProps)'.

However, based on the doc, it does have render for Route. How to use it correctly?

ANSWER

Answered 2022-Mar-18 at 18:41

I think you should use the no match route approach.

Check this in the documentation.

https://reactrouter.com/docs/en/v6/getting-started/tutorial#adding-a-no-match-route

1import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
2
3<BrowserRouter>
4  <Routes>
5    <Route path="/" element={<Home />} />
6    <Route path="/lab" element={<Lab />} />
7    <Route render={() => <Navigate to="/" />} />
8  </Routes>
9</BrowserRouter>
10import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
11
12<BrowserRouter>
13  <Routes>
14    <Route path="/" element={<Home />} />
15    <Route path="/lab" element={<Lab />} />
16    <Route
17        path="*"
18        element={<Navigate to="/" replace />}
19    />
20  </Routes>
21</BrowserRouter>
22
Update - 18/03/2022

To keep the history clean, you should set replace prop. This will avoid extra redirects after the user click back. Thanks @Paul for this tip.

Source https://stackoverflow.com/questions/69868956

QUESTION

Error: [PrivateRoute] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>

Asked 2022-Mar-24 at 16:08

I'm using React Router v6 and am creating private routes for my application.

In file PrivateRoute.js, I've the code

1import React from 'react';
2import {Route,Navigate} from "react-router-dom";
3import {isauth}  from 'auth'
4
5function PrivateRoute({ element, path }) {
6  const authed = isauth() // isauth() returns true or false based on localStorage
7  const ele = authed === true ? element : <Navigate to="/Home"  />;
8  return <Route path={path} element={ele} />;
9}
10
11export default PrivateRoute
12

And in file route.js I've written as:

1import React from 'react';
2import {Route,Navigate} from "react-router-dom";
3import {isauth}  from 'auth'
4
5function PrivateRoute({ element, path }) {
6  const authed = isauth() // isauth() returns true or false based on localStorage
7  const ele = authed === true ? element : <Navigate to="/Home"  />;
8  return <Route path={path} element={ele} />;
9}
10
11export default PrivateRoute
12 ...
13<PrivateRoute exact path="/" element={<Dashboard/>}/>
14<Route exact path="/home" element={<Home/>}/>
15

I've gone through the same example React-router Auth Example - StackBlitz, file App.tsx

Is there something I'm missing?

ANSWER

Answered 2021-Nov-12 at 21:20

I ran into the same issue today and came up with the following solution based on this very helpful article by Andrew Luca

In PrivateRoute.js:

1import React from 'react';
2import {Route,Navigate} from "react-router-dom";
3import {isauth}  from 'auth'
4
5function PrivateRoute({ element, path }) {
6  const authed = isauth() // isauth() returns true or false based on localStorage
7  const ele = authed === true ? element : <Navigate to="/Home"  />;
8  return <Route path={path} element={ele} />;
9}
10
11export default PrivateRoute
12 ...
13<PrivateRoute exact path="/" element={<Dashboard/>}/>
14<Route exact path="/home" element={<Home/>}/>
15import React from 'react';
16import { Navigate, Outlet } from 'react-router-dom';
17
18const PrivateRoute = () => {
19    const auth = null; // determine if authorized, from context or however you're doing it
20
21    // If authorized, return an outlet that will render child elements
22    // If not, return element that will navigate to login page
23    return auth ? <Outlet /> : <Navigate to="/login" />;
24}
25

In App.js (I've left in some other pages as examples):

1import React from 'react';
2import {Route,Navigate} from "react-router-dom";
3import {isauth}  from 'auth'
4
5function PrivateRoute({ element, path }) {
6  const authed = isauth() // isauth() returns true or false based on localStorage
7  const ele = authed === true ? element : <Navigate to="/Home"  />;
8  return <Route path={path} element={ele} />;
9}
10
11export default PrivateRoute
12 ...
13<PrivateRoute exact path="/" element={<Dashboard/>}/>
14<Route exact path="/home" element={<Home/>}/>
15import React from 'react';
16import { Navigate, Outlet } from 'react-router-dom';
17
18const PrivateRoute = () => {
19    const auth = null; // determine if authorized, from context or however you're doing it
20
21    // If authorized, return an outlet that will render child elements
22    // If not, return element that will navigate to login page
23    return auth ? <Outlet /> : <Navigate to="/login" />;
24}
25import './App.css';
26import React, {Fragment} from 'react';
27import {BrowserRouter as Router, Route, Routes} from 'react-router-dom';
28import Navbar from './components/layout/Navbar';
29import Home from './components/pages/Home';
30import Register from './components/auth/Register'
31import Login from './components/auth/Login';
32import PrivateRoute from './components/routing/PrivateRoute';
33
34const App = () => {
35  return (
36    <Router>
37      <Fragment>
38        <Navbar/>
39        <Routes>
40          <Route exact path='/' element={<PrivateRoute/>}>
41            <Route exact path='/' element={<Home/>}/>
42          </Route>
43          <Route exact path='/register' element={<Register/>}/>
44          <Route exact path='/login' element={<Login/>}/>
45        </Routes>
46      </Fragment>
47    </Router>
48    
49  );
50}
51

In the above routing, this is the private route:

1import React from 'react';
2import {Route,Navigate} from "react-router-dom";
3import {isauth}  from 'auth'
4
5function PrivateRoute({ element, path }) {
6  const authed = isauth() // isauth() returns true or false based on localStorage
7  const ele = authed === true ? element : <Navigate to="/Home"  />;
8  return <Route path={path} element={ele} />;
9}
10
11export default PrivateRoute
12 ...
13<PrivateRoute exact path="/" element={<Dashboard/>}/>
14<Route exact path="/home" element={<Home/>}/>
15import React from 'react';
16import { Navigate, Outlet } from 'react-router-dom';
17
18const PrivateRoute = () => {
19    const auth = null; // determine if authorized, from context or however you're doing it
20
21    // If authorized, return an outlet that will render child elements
22    // If not, return element that will navigate to login page
23    return auth ? <Outlet /> : <Navigate to="/login" />;
24}
25import './App.css';
26import React, {Fragment} from 'react';
27import {BrowserRouter as Router, Route, Routes} from 'react-router-dom';
28import Navbar from './components/layout/Navbar';
29import Home from './components/pages/Home';
30import Register from './components/auth/Register'
31import Login from './components/auth/Login';
32import PrivateRoute from './components/routing/PrivateRoute';
33
34const App = () => {
35  return (
36    <Router>
37      <Fragment>
38        <Navbar/>
39        <Routes>
40          <Route exact path='/' element={<PrivateRoute/>}>
41            <Route exact path='/' element={<Home/>}/>
42          </Route>
43          <Route exact path='/register' element={<Register/>}/>
44          <Route exact path='/login' element={<Login/>}/>
45        </Routes>
46      </Fragment>
47    </Router>
48    
49  );
50}
51<Route exact path='/' element={<PrivateRoute/>}>
52      <Route exact path='/' element={<Home/>}/>
53</Route>
54

If authorization is successful, the element will show. Otherwise, it will navigate to the login page.

Source https://stackoverflow.com/questions/69864165

QUESTION

new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method

Asked 2022-Mar-24 at 07:42

I cannot resolve the issue. When application loads react native throw warnings. new NativeEventEmitter() was called with a non-null argument without the required addListener method. WARN new NativeEventEmitter() was called with a non-null argument without the required removeListeners method.

ANSWER

Answered 2021-Nov-24 at 11:07

This is likely due to the newest version of react-native. A lot of libraries still haven't released a new version to handle these warnings (or errors in some case). Examples include https://github.com/react-navigation/react-navigation/issues/9882 and https://github.com/APSL/react-native-keyboard-aware-scroll-view/pull/501. If it bothers you, you can hide the warning for now (source):

1import { LogBox } from 'react-native';
2LogBox.ignoreLogs(['new NativeEventEmitter']); // Ignore log notification by message
3LogBox.ignoreAllLogs(); //Ignore all log notifications
4

Source https://stackoverflow.com/questions/69538962

QUESTION

ESlint - Error: Must use import to load ES Module

Asked 2022-Mar-17 at 12:13

I am currently setting up a boilerplate with React, Typescript, styled components, webpack etc. and I am getting an error when trying to run eslint:

Error: Must use import to load ES Module

Here is a more verbose version of the error:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6

The error occurs in every single one of my .js and .ts/ .tsx files where I only use import or the file doesn't even have an import at all. I understand what the error is saying but I have no idea why it is being thrown when in fact I only use imports or even no imports at all in some files.

Here is my package.json where I trigger the linter from using npm run lint:eslint:quiet:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7  "name": "my-react-boilerplate",
8  "version": "1.0.0",
9  "description": "",
10  "main": "index.tsx",
11  "directories": {
12    "test": "test"
13  },
14  "engines": {
15    "node": ">=14.0.0"
16  },
17  "type": "module",
18  "scripts": {
19    "build": "webpack --config webpack.prod.js",
20    "dev": "webpack serve --config webpack.dev.js",
21    "lint": "npm run typecheck && npm run lint:css && npm run lint:eslint:quiet",
22    "lint:css": "stylelint './src/**/*.{js,ts,tsx}'",
23    "lint:eslint:quiet": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet",
24    "lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern",
25    "lint:eslint:fix": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet --fix",
26    "test": "cross-env NODE_ENV=test jest --coverage",
27    "test:watch": "cross-env NODE_ENV=test jest --watchAll",
28    "typecheck": "tsc --noEmit",
29    "precommit": "npm run lint"
30  },
31  "lint-staged": {
32    "*.{ts,tsx,js,jsx}": [
33      "npm run lint:eslint:fix",
34      "git add --force"
35    ],
36    "*.{md,json}": [
37      "prettier --write",
38      "git add --force"
39    ]
40  },
41  "husky": {
42    "hooks": {
43      "pre-commit": "npx lint-staged && npm run typecheck"
44    }
45  },
46  "resolutions": {
47    "styled-components": "^5"
48  },
49  "author": "",
50  "license": "ISC",
51  "devDependencies": {
52    "@babel/core": "^7.5.4",
53    "@babel/plugin-proposal-class-properties": "^7.5.0",
54    "@babel/preset-env": "^7.5.4",
55    "@babel/preset-react": "^7.0.0",
56    "@types/history": "^4.7.6",
57    "@types/react": "^17.0.29",
58    "@types/react-dom": "^17.0.9",
59    "@types/react-router": "^5.1.17",
60    "@types/react-router-dom": "^5.1.5",
61    "@types/styled-components": "^5.1.15",
62    "@typescript-eslint/eslint-plugin": "^5.0.0",
63    "babel-cli": "^6.26.0",
64    "babel-eslint": "^10.0.2",
65    "babel-loader": "^8.0.0-beta.6",
66    "babel-polyfill": "^6.26.0",
67    "babel-preset-env": "^1.7.0",
68    "babel-preset-react": "^6.24.1",
69    "babel-preset-stage-2": "^6.24.1",
70    "clean-webpack-plugin": "^4.0.0",
71    "dotenv-webpack": "^7.0.3",
72    "error-overlay-webpack-plugin": "^1.0.0",
73    "eslint": "^8.0.0",
74    "eslint-config-airbnb": "^18.2.0",
75    "eslint-config-prettier": "^8.3.0",
76    "eslint-config-with-prettier": "^6.0.0",
77    "eslint-plugin-compat": "^3.3.0",
78    "eslint-plugin-import": "^2.25.2",
79    "eslint-plugin-jsx-a11y": "^6.2.3",
80    "eslint-plugin-prettier": "^4.0.0",
81    "eslint-plugin-react": "^7.14.2",
82    "eslint-plugin-react-hooks": "^4.2.0",
83    "extract-text-webpack-plugin": "^3.0.2",
84    "file-loader": "^6.2.0",
85    "html-webpack-plugin": "^5.3.2",
86    "husky": "^7.0.2",
87    "prettier": "^2.4.1",
88    "raw-loader": "^4.0.2",
89    "style-loader": "^3.3.0",
90    "stylelint": "^13.13.1",
91    "stylelint-config-recommended": "^5.0.0",
92    "stylelint-config-styled-components": "^0.1.1",
93    "stylelint-processor-styled-components": "^1.10.0",
94    "ts-loader": "^9.2.6",
95    "tslint": "^6.1.3",
96    "typescript": "^4.4.4",
97    "url-loader": "^4.1.1",
98    "webpack": "^5.58.2",
99    "webpack-cli": "^4.2.0",
100    "webpack-dev-server": "^4.3.1",
101    "webpack-merge": "^5.3.0"
102  },
103  "dependencies": {
104    "history": "^4.10.0",
105    "process": "^0.11.10",
106    "react": "^17.0.1",
107    "react-dom": "^17.0.1",
108    "react-router-dom": "^5.2.0",
109    "styled-components": "^5.2.1"
110  }
111}
112

Here is my .eslintrc file:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7  "name": "my-react-boilerplate",
8  "version": "1.0.0",
9  "description": "",
10  "main": "index.tsx",
11  "directories": {
12    "test": "test"
13  },
14  "engines": {
15    "node": ">=14.0.0"
16  },
17  "type": "module",
18  "scripts": {
19    "build": "webpack --config webpack.prod.js",
20    "dev": "webpack serve --config webpack.dev.js",
21    "lint": "npm run typecheck && npm run lint:css && npm run lint:eslint:quiet",
22    "lint:css": "stylelint './src/**/*.{js,ts,tsx}'",
23    "lint:eslint:quiet": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet",
24    "lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern",
25    "lint:eslint:fix": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet --fix",
26    "test": "cross-env NODE_ENV=test jest --coverage",
27    "test:watch": "cross-env NODE_ENV=test jest --watchAll",
28    "typecheck": "tsc --noEmit",
29    "precommit": "npm run lint"
30  },
31  "lint-staged": {
32    "*.{ts,tsx,js,jsx}": [
33      "npm run lint:eslint:fix",
34      "git add --force"
35    ],
36    "*.{md,json}": [
37      "prettier --write",
38      "git add --force"
39    ]
40  },
41  "husky": {
42    "hooks": {
43      "pre-commit": "npx lint-staged && npm run typecheck"
44    }
45  },
46  "resolutions": {
47    "styled-components": "^5"
48  },
49  "author": "",
50  "license": "ISC",
51  "devDependencies": {
52    "@babel/core": "^7.5.4",
53    "@babel/plugin-proposal-class-properties": "^7.5.0",
54    "@babel/preset-env": "^7.5.4",
55    "@babel/preset-react": "^7.0.0",
56    "@types/history": "^4.7.6",
57    "@types/react": "^17.0.29",
58    "@types/react-dom": "^17.0.9",
59    "@types/react-router": "^5.1.17",
60    "@types/react-router-dom": "^5.1.5",
61    "@types/styled-components": "^5.1.15",
62    "@typescript-eslint/eslint-plugin": "^5.0.0",
63    "babel-cli": "^6.26.0",
64    "babel-eslint": "^10.0.2",
65    "babel-loader": "^8.0.0-beta.6",
66    "babel-polyfill": "^6.26.0",
67    "babel-preset-env": "^1.7.0",
68    "babel-preset-react": "^6.24.1",
69    "babel-preset-stage-2": "^6.24.1",
70    "clean-webpack-plugin": "^4.0.0",
71    "dotenv-webpack": "^7.0.3",
72    "error-overlay-webpack-plugin": "^1.0.0",
73    "eslint": "^8.0.0",
74    "eslint-config-airbnb": "^18.2.0",
75    "eslint-config-prettier": "^8.3.0",
76    "eslint-config-with-prettier": "^6.0.0",
77    "eslint-plugin-compat": "^3.3.0",
78    "eslint-plugin-import": "^2.25.2",
79    "eslint-plugin-jsx-a11y": "^6.2.3",
80    "eslint-plugin-prettier": "^4.0.0",
81    "eslint-plugin-react": "^7.14.2",
82    "eslint-plugin-react-hooks": "^4.2.0",
83    "extract-text-webpack-plugin": "^3.0.2",
84    "file-loader": "^6.2.0",
85    "html-webpack-plugin": "^5.3.2",
86    "husky": "^7.0.2",
87    "prettier": "^2.4.1",
88    "raw-loader": "^4.0.2",
89    "style-loader": "^3.3.0",
90    "stylelint": "^13.13.1",
91    "stylelint-config-recommended": "^5.0.0",
92    "stylelint-config-styled-components": "^0.1.1",
93    "stylelint-processor-styled-components": "^1.10.0",
94    "ts-loader": "^9.2.6",
95    "tslint": "^6.1.3",
96    "typescript": "^4.4.4",
97    "url-loader": "^4.1.1",
98    "webpack": "^5.58.2",
99    "webpack-cli": "^4.2.0",
100    "webpack-dev-server": "^4.3.1",
101    "webpack-merge": "^5.3.0"
102  },
103  "dependencies": {
104    "history": "^4.10.0",
105    "process": "^0.11.10",
106    "react": "^17.0.1",
107    "react-dom": "^17.0.1",
108    "react-router-dom": "^5.2.0",
109    "styled-components": "^5.2.1"
110  }
111}
112{
113  "extends": ["airbnb", "prettier"],
114  "parser": "babel-eslint",
115  "plugins": ["prettier", "@typescript-eslint"],
116  "parserOptions": {
117    "ecmaVersion": 8,
118    "ecmaFeatures": {
119      "experimentalObjectRestSpread": true,
120      "impliedStrict": true,
121      "classes": true
122    }
123  },
124  "env": {
125    "browser": true,
126    "node": true,
127    "jest": true
128  },
129  "rules": {
130    "arrow-body-style": ["error", "as-needed"],
131    "class-methods-use-this": 0,
132    "react/jsx-filename-extension": 0,
133    "global-require": 0,
134    "react/destructuring-assignment": 0,
135    "import/named": 2,
136    "linebreak-style": 0,
137    "import/no-dynamic-require": 0,
138    "import/no-named-as-default": 0,
139    "import/no-unresolved": 2,
140    "import/prefer-default-export": 0,
141    "semi": [2, "always"],
142    "max-len": [
143      "error",
144      {
145        "code": 80,
146        "ignoreUrls": true,
147        "ignoreComments": true,
148        "ignoreStrings": true,
149        "ignoreTemplateLiterals": true
150      }
151    ],
152    "new-cap": [
153      2,
154      {
155        "capIsNew": false,
156        "newIsCap": true
157      }
158    ],
159    "no-param-reassign": 0,
160    "no-shadow": 0,
161    "no-tabs": 2,
162    "no-underscore-dangle": 0,
163    "react/forbid-prop-types": [
164      "error",
165      {
166        "forbid": ["any"]
167      }
168    ],
169    "import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
170    "react/jsx-no-bind": [
171      "error",
172      {
173        "ignoreRefs": true,
174        "allowArrowFunctions": true,
175        "allowBind": false
176      }
177    ],
178    "react/no-unknown-property": [
179      2,
180      {
181        "ignore": ["itemscope", "itemtype", "itemprop"]
182      }
183    ]
184  }
185}
186

And i'm not sure if relevant but also my tsconfig.eslint.json file:

1/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts
2  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js
3require() of ES modules is not supported.
4require() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
5Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/package.json
6{
7  "name": "my-react-boilerplate",
8  "version": "1.0.0",
9  "description": "",
10  "main": "index.tsx",
11  "directories": {
12    "test": "test"
13  },
14  "engines": {
15    "node": ">=14.0.0"
16  },
17  "type": "module",
18  "scripts": {
19    "build": "webpack --config webpack.prod.js",
20    "dev": "webpack serve --config webpack.dev.js",
21    "lint": "npm run typecheck && npm run lint:css && npm run lint:eslint:quiet",
22    "lint:css": "stylelint './src/**/*.{js,ts,tsx}'",
23    "lint:eslint:quiet": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet",
24    "lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern",
25    "lint:eslint:fix": "eslint --ext .ts,.tsx,.js,.jsx  ./src --no-error-on-unmatched-pattern --quiet --fix",
26    "test": "cross-env NODE_ENV=test jest --coverage",
27    "test:watch": "cross-env NODE_ENV=test jest --watchAll",
28    "typecheck": "tsc --noEmit",
29    "precommit": "npm run lint"
30  },
31  "lint-staged": {
32    "*.{ts,tsx,js,jsx}": [
33      "npm run lint:eslint:fix",
34      "git add --force"
35    ],
36    "*.{md,json}": [
37      "prettier --write",
38      "git add --force"
39    ]
40  },
41  "husky": {
42    "hooks": {
43      "pre-commit": "npx lint-staged && npm run typecheck"
44    }
45  },
46  "resolutions": {
47    "styled-components": "^5"
48  },
49  "author": "",
50  "license": "ISC",
51  "devDependencies": {
52    "@babel/core": "^7.5.4",
53    "@babel/plugin-proposal-class-properties": "^7.5.0",
54    "@babel/preset-env": "^7.5.4",
55    "@babel/preset-react": "^7.0.0",
56    "@types/history": "^4.7.6",
57    "@types/react": "^17.0.29",
58    "@types/react-dom": "^17.0.9",
59    "@types/react-router": "^5.1.17",
60    "@types/react-router-dom": "^5.1.5",
61    "@types/styled-components": "^5.1.15",
62    "@typescript-eslint/eslint-plugin": "^5.0.0",
63    "babel-cli": "^6.26.0",
64    "babel-eslint": "^10.0.2",
65    "babel-loader": "^8.0.0-beta.6",
66    "babel-polyfill": "^6.26.0",
67    "babel-preset-env": "^1.7.0",
68    "babel-preset-react": "^6.24.1",
69    "babel-preset-stage-2": "^6.24.1",
70    "clean-webpack-plugin": "^4.0.0",
71    "dotenv-webpack": "^7.0.3",
72    "error-overlay-webpack-plugin": "^1.0.0",
73    "eslint": "^8.0.0",
74    "eslint-config-airbnb": "^18.2.0",
75    "eslint-config-prettier": "^8.3.0",
76    "eslint-config-with-prettier": "^6.0.0",
77    "eslint-plugin-compat": "^3.3.0",
78    "eslint-plugin-import": "^2.25.2",
79    "eslint-plugin-jsx-a11y": "^6.2.3",
80    "eslint-plugin-prettier": "^4.0.0",
81    "eslint-plugin-react": "^7.14.2",
82    "eslint-plugin-react-hooks": "^4.2.0",
83    "extract-text-webpack-plugin": "^3.0.2",
84    "file-loader": "^6.2.0",
85    "html-webpack-plugin": "^5.3.2",
86    "husky": "^7.0.2",
87    "prettier": "^2.4.1",
88    "raw-loader": "^4.0.2",
89    "style-loader": "^3.3.0",
90    "stylelint": "^13.13.1",
91    "stylelint-config-recommended": "^5.0.0",
92    "stylelint-config-styled-components": "^0.1.1",
93    "stylelint-processor-styled-components": "^1.10.0",
94    "ts-loader": "^9.2.6",
95    "tslint": "^6.1.3",
96    "typescript": "^4.4.4",
97    "url-loader": "^4.1.1",
98    "webpack": "^5.58.2",
99    "webpack-cli": "^4.2.0",
100    "webpack-dev-server": "^4.3.1",
101    "webpack-merge": "^5.3.0"
102  },
103  "dependencies": {
104    "history": "^4.10.0",
105    "process": "^0.11.10",
106    "react": "^17.0.1",
107    "react-dom": "^17.0.1",
108    "react-router-dom": "^5.2.0",
109    "styled-components": "^5.2.1"
110  }
111}
112{
113  "extends": ["airbnb", "prettier"],
114  "parser": "babel-eslint",
115  "plugins": ["prettier", "@typescript-eslint"],
116  "parserOptions": {
117    "ecmaVersion": 8,
118    "ecmaFeatures": {
119      "experimentalObjectRestSpread": true,
120      "impliedStrict": true,
121      "classes": true
122    }
123  },
124  "env": {
125    "browser": true,
126    "node": true,
127    "jest": true
128  },
129  "rules": {
130    "arrow-body-style": ["error", "as-needed"],
131    "class-methods-use-this": 0,
132    "react/jsx-filename-extension": 0,
133    "global-require": 0,
134    "react/destructuring-assignment": 0,
135    "import/named": 2,
136    "linebreak-style": 0,
137    "import/no-dynamic-require": 0,
138    "import/no-named-as-default": 0,
139    "import/no-unresolved": 2,
140    "import/prefer-default-export": 0,
141    "semi": [2, "always"],
142    "max-len": [
143      "error",
144      {
145        "code": 80,
146        "ignoreUrls": true,
147        "ignoreComments": true,
148        "ignoreStrings": true,
149        "ignoreTemplateLiterals": true
150      }
151    ],
152    "new-cap": [
153      2,
154      {
155        "capIsNew": false,
156        "newIsCap": true
157      }
158    ],
159    "no-param-reassign": 0,
160    "no-shadow": 0,
161    "no-tabs": 2,
162    "no-underscore-dangle": 0,
163    "react/forbid-prop-types": [
164      "error",
165      {
166        "forbid": ["any"]
167      }
168    ],
169    "import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
170    "react/jsx-no-bind": [
171      "error",
172      {
173        "ignoreRefs": true,
174        "allowArrowFunctions": true,
175        "allowBind": false
176      }
177    ],
178    "react/no-unknown-property": [
179      2,
180      {
181        "ignore": ["itemscope", "itemtype", "itemprop"]
182      }
183    ]
184  }
185}
186{
187  "extends": "./tsconfig.json",
188  "include": ["./src/**/*.ts", "./src/**/*.tsx", "./src/**/*.js"],
189  "exclude": ["node_modules/**", "build/**", "coverage/**"]
190}
191

Not sure if anyone has come across this before? Googling the error does not present any useful forums or raised bugs, most of them just state not to use require in your files which I am not.

ANSWER

Answered 2022-Mar-15 at 16:08

I think the problem is that you are trying to use the deprecated babel-eslint parser, last updated a year ago, which looks like it doesn't support ES6 modules. Updating to the latest parser seems to work, at least for simple linting.

So, do this:

  • In package.json, update the line "babel-eslint": "^10.0.2", to "@babel/eslint-parser": "^7.5.4",. This works with the code above but it may be better to use the latest version, which at the time of writing is 7.16.3.
  • Run npm i from a terminal/command prompt in the folder
  • In .eslintrc, update the parser line "parser": "babel-eslint", to "parser": "@babel/eslint-parser",
  • In .eslintrc, add "requireConfigFile": false, to the parserOptions section (underneath "ecmaVersion": 8,) (I needed this or babel was looking for config files I don't have)
  • Run the command to lint a file

Then, for me with just your two configuration files, the error goes away and I get appropriate linting errors.

Source https://stackoverflow.com/questions/69554485

QUESTION

Android app won't build -- The minCompileSdk (31) specified in a dependency's androidx.work:work-runtime:2.7.0-beta01

Asked 2022-Mar-11 at 16:01

I'm trying to build a project in my M1,

but I got this error when I run npx react-native run-android

1FAILURE: Build failed with an exception.
2
3* What went wrong:
4Execution failed for task ':app:checkDebugAarMetadata'.
5> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
6   > The minCompileSdk (31) specified in a
7     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
8     is greater than this module's compileSdkVersion (android-30).
9     Dependency: androidx.work:work-runtime:2.7.0-beta01.
10     AAR metadata file: /Users/macpro/.gradle/caches/transforms-3/999e9d813832e06d8f1b7de52647a502/transformed/work-runtime-2.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.
11

Android/build.gradle

1FAILURE: Build failed with an exception.
2
3* What went wrong:
4Execution failed for task ':app:checkDebugAarMetadata'.
5> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
6   > The minCompileSdk (31) specified in a
7     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
8     is greater than this module's compileSdkVersion (android-30).
9     Dependency: androidx.work:work-runtime:2.7.0-beta01.
10     AAR metadata file: /Users/macpro/.gradle/caches/transforms-3/999e9d813832e06d8f1b7de52647a502/transformed/work-runtime-2.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.
11// Top-level build file where you can add configuration options common to all sub-projects/modules.
12
13buildscript {
14    ext {
15        buildToolsVersion = "30.0.0"
16        minSdkVersion = 21
17        compileSdkVersion = 30
18        targetSdkVersion = 30
19        supportLibVersion   = "28.0.0"
20    }
21    repositories {
22        google()
23        jcenter()
24    }
25    dependencies {
26        classpath('com.android.tools.build:gradle:4.1.2')
27        classpath('com.google.gms:google-services:4.3.0')
28        // NOTE: Do not place your application dependencies here; they belong
29        // in the individual module build.gradle files
30    }
31}
32
33allprojects {
34    repositories {
35        mavenLocal()
36        maven {
37            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
38            url("$rootDir/../node_modules/react-native/android")
39        }
40        maven {
41            // Android JSC is installed from npm
42            url("$rootDir/../node_modules/jsc-android/dist")
43        }
44
45        google()
46        jcenter()
47        maven { url 'https://www.jitpack.io' }
48    }
49    
50}
51

gradle-wrapper.properties

1FAILURE: Build failed with an exception.
2
3* What went wrong:
4Execution failed for task ':app:checkDebugAarMetadata'.
5> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
6   > The minCompileSdk (31) specified in a
7     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
8     is greater than this module's compileSdkVersion (android-30).
9     Dependency: androidx.work:work-runtime:2.7.0-beta01.
10     AAR metadata file: /Users/macpro/.gradle/caches/transforms-3/999e9d813832e06d8f1b7de52647a502/transformed/work-runtime-2.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.
11// Top-level build file where you can add configuration options common to all sub-projects/modules.
12
13buildscript {
14    ext {
15        buildToolsVersion = "30.0.0"
16        minSdkVersion = 21
17        compileSdkVersion = 30
18        targetSdkVersion = 30
19        supportLibVersion   = "28.0.0"
20    }
21    repositories {
22        google()
23        jcenter()
24    }
25    dependencies {
26        classpath('com.android.tools.build:gradle:4.1.2')
27        classpath('com.google.gms:google-services:4.3.0')
28        // NOTE: Do not place your application dependencies here; they belong
29        // in the individual module build.gradle files
30    }
31}
32
33allprojects {
34    repositories {
35        mavenLocal()
36        maven {
37            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
38            url("$rootDir/../node_modules/react-native/android")
39        }
40        maven {
41            // Android JSC is installed from npm
42            url("$rootDir/../node_modules/jsc-android/dist")
43        }
44
45        google()
46        jcenter()
47        maven { url 'https://www.jitpack.io' }
48    }
49    
50}
51distributionBase=GRADLE_USER_HOME
52distributionPath=wrapper/dists
53distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
54zipStoreBase=GRADLE_USER_HOME
55zipStorePath=wrapper/dists
56

ANSWER

Answered 2021-Sep-02 at 23:03

The error is being caused because one of your dependencies is internally using WorkManager 2.7.0-beta01 that was released today (which needs API 31). In my case it was CheckAarMetadata.kt.

You can fix it by forcing Gradle to use an older version of Work Manager for the transitive dependency that works with API 30. In your build.gradle file add:

1FAILURE: Build failed with an exception.
2
3* What went wrong:
4Execution failed for task ':app:checkDebugAarMetadata'.
5> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
6   > The minCompileSdk (31) specified in a
7     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
8     is greater than this module's compileSdkVersion (android-30).
9     Dependency: androidx.work:work-runtime:2.7.0-beta01.
10     AAR metadata file: /Users/macpro/.gradle/caches/transforms-3/999e9d813832e06d8f1b7de52647a502/transformed/work-runtime-2.7.0-beta01/META-INF/com/android/build/gradle/aar-metadata.properties.
11// Top-level build file where you can add configuration options common to all sub-projects/modules.
12
13buildscript {
14    ext {
15        buildToolsVersion = "30.0.0"
16        minSdkVersion = 21
17        compileSdkVersion = 30
18        targetSdkVersion = 30
19        supportLibVersion   = "28.0.0"
20    }
21    repositories {
22        google()
23        jcenter()
24    }
25    dependencies {
26        classpath('com.android.tools.build:gradle:4.1.2')
27        classpath('com.google.gms:google-services:4.3.0')
28        // NOTE: Do not place your application dependencies here; they belong
29        // in the individual module build.gradle files
30    }
31}
32
33allprojects {
34    repositories {
35        mavenLocal()
36        maven {
37            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
38            url("$rootDir/../node_modules/react-native/android")
39        }
40        maven {
41            // Android JSC is installed from npm
42            url("$rootDir/../node_modules/jsc-android/dist")
43        }
44
45        google()
46        jcenter()
47        maven { url 'https://www.jitpack.io' }
48    }
49    
50}
51distributionBase=GRADLE_USER_HOME
52distributionPath=wrapper/dists
53distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
54zipStoreBase=GRADLE_USER_HOME
55zipStorePath=wrapper/dists
56dependencies {
57    def work_version = "2.6.0"
58    // Force WorkManager 2.6.0 for transitive dependency
59    implementation("androidx.work:work-runtime-ktx:$work_version") {
60        force = true
61    }
62}
63

This should fix it.

Source https://stackoverflow.com/questions/69037481

QUESTION

Error when deploying react app and it keeps sayings << Plugin "react" was conflicted between "package.json » eslint-config-react-app » >>

Asked 2022-Mar-09 at 14:04

I have been having a little bit of issues when deploying my create react app, as it fails to compile and tells me Plugin "react" was conflicted between "package.json » eslint-config-react-app »

I was wondering if somebody has encountered the same issue and knows how to solve it, thank you! I am still very new to all this.

eHere is what my windows powershell tells me once I npm start and launches

This is what my localhost looks like once my react app launches

ANSWER

Answered 2021-Dec-17 at 09:47

There is a conflict in the casing

C:\Users\Ruben|desktop\reactapp\test.... whereas the nodemodules is looking for C:\Users\Ruben|Desktop\Reactapp\test....

This is a windows specific problem, and previously react would have run the app regardless of this difference. Not anymore it seems.

The solution I used was to locate the folder and open with code; that ensures that the path matches directly with what is stored in node modules

Source https://stackoverflow.com/questions/70377211

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in React

Share this Page

share link

Get latest updates on React