i18next / react-i18next

Internationalization for react done right. Using the i18next i18n ecosystem.
https://react.i18next.com
MIT License
9.32k stars 1.03k forks source link

Can't run using 15.0.1 #1800

Closed maulanauls closed 2 months ago

maulanauls commented 2 months ago

🐛 Bug Report

I try install using react-i18next using version 15.0.1 but cant start error when running please help to fix this issue ?

./node_modules/react-i18next/dist/es/context.js
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

'??' !== '||'
    at Array.forEach (<anonymous>)

Environment

adrai commented 2 months ago

https://github.com/i18next/react-i18next/issues/1797

//cc @VIKTORVAV99

VIKTORVAV99 commented 2 months ago

@maulanauls can you start by filling out your actual runtime environment?

maulanauls commented 2 months ago

@maulanauls can you start by filling out your actual runtime environment?

`Failed to compile.

./node_modules/react-i18next/dist/es/context.js AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

'??' !== '||' at Array.forEach ()`

{ "name": "gp_monitoring", "version": "0.1.0", "private": true, "dependencies": { "@material-ui/core": "^3.8.1", "axios": "^0.19.0", "base-64": "^0.1.0", "i18next": "^23.12.3", "i18next-browser-languagedetector": "^8.0.0", "i18next-http-backend": "^2.5.2", "plotly.js": "^1.55.1", "plotly.js-basic-dist": "^1.55.1", "qrcode.react": "^1.0.0", "query-string": "^6.8.2", "react": "^16.3.0", "react-date-picker": "^7.2.0", "react-dom": "^16.7.0", "react-i18next": "^15.0.1", "react-plotly.js": "^2.4.0", "react-rating": "^1.6.2", "react-router-dom": "^4.3.1", "react-scripts": "2.1.2", "react-spinners": "^0.10.6", "react-switch": "^4.1.0", "react-time-picker": "^3.2.0" }, "scripts": { "start": "set PORT=1991 && react-scripts start", "dev": "export $(grep -vE '^(#|##)' .env.local | xargs) && PORT=1991 NODE_OPTIONS=--openssl-legacy-provider react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ], "devDependencies": { "@babel/plugin-proposal-class-properties": "^7.18.6" } }

Environment

VIKTORVAV99 commented 2 months ago

@maulanauls can you start by filling out your actual runtime environment?

`Failed to compile.

./node_modules/react-i18next/dist/es/context.js

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

'??' !== '||'

at Array.forEach (<anonymous>)`

`{

"name": "gp_monitoring",

"version": "0.1.0",

"private": true,

"dependencies": {

"@material-ui/core": "^3.8.1",

"axios": "^0.19.0",

"base-64": "^0.1.0",

"i18next": "^23.12.3",

"i18next-browser-languagedetector": "^8.0.0",

"i18next-http-backend": "^2.5.2",

"plotly.js": "^1.55.1",

"plotly.js-basic-dist": "^1.55.1",

"qrcode.react": "^1.0.0",

"query-string": "^6.8.2",

"react": "^16.3.0",

"react-date-picker": "^7.2.0",

"react-dom": "^16.7.0",

"react-i18next": "^15.0.1",

"react-plotly.js": "^2.4.0",

"react-rating": "^1.6.2",

"react-router-dom": "^4.3.1",

"react-scripts": "2.1.2",

"react-spinners": "^0.10.6",

"react-switch": "^4.1.0",

"react-time-picker": "^3.2.0"

},

"scripts": {

"start": "set PORT=1991 && react-scripts start",

"dev": "export $(grep -vE '^(#|##)' .env.local | xargs) && PORT=1991 NODE_OPTIONS=--openssl-legacy-provider react-scripts start",

"build": "react-scripts build",

"test": "react-scripts test",

"eject": "react-scripts eject"

},

"eslintConfig": {

"extends": "react-app"

},

"browserslist": [

">0.2%",

"not dead",

"not ie <= 11",

"not op_mini all"

],

"devDependencies": {

"@babel/plugin-proposal-class-properties": "^7.18.6"

}

}

`

Environment

That's just the error and configs, what's the environment you're running this in?

maulanauls commented 2 months ago

@maulanauls can you start by filling out your actual runtime environment?

`Failed to compile. ./node_modules/react-i18next/dist/es/context.js AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: '??' !== '||'

at Array.forEach (<anonymous>)`

`{ "name": "gp_monitoring", "version": "0.1.0", "private": true, "dependencies": {

"@material-ui/core": "^3.8.1",

"axios": "^0.19.0",

"base-64": "^0.1.0",

"i18next": "^23.12.3",

"i18next-browser-languagedetector": "^8.0.0",

"i18next-http-backend": "^2.5.2",

"plotly.js": "^1.55.1",

"plotly.js-basic-dist": "^1.55.1",

"qrcode.react": "^1.0.0",

"query-string": "^6.8.2",

"react": "^16.3.0",

"react-date-picker": "^7.2.0",

"react-dom": "^16.7.0",

"react-i18next": "^15.0.1",

"react-plotly.js": "^2.4.0",

"react-rating": "^1.6.2",

"react-router-dom": "^4.3.1",

"react-scripts": "2.1.2",

"react-spinners": "^0.10.6",

"react-switch": "^4.1.0",

"react-time-picker": "^3.2.0"

}, "scripts": {

"start": "set PORT=1991 && react-scripts start",

"dev": "export $(grep -vE '^(#|##)' .env.local | xargs) && PORT=1991 NODE_OPTIONS=--openssl-legacy-provider react-scripts start",

"build": "react-scripts build",

"test": "react-scripts test",

"eject": "react-scripts eject"

}, "eslintConfig": {

"extends": "react-app"

}, "browserslist": [

">0.2%",

"not dead",

"not ie <= 11",

"not op_mini all"

], "devDependencies": {

"@babel/plugin-proposal-class-properties": "^7.18.6"

} } `

Environment

  • runtime version: i.e. node v20, vscode, browser google chrome
  • i18next version: i.e. 15.0.1
  • os: Mac

https://ibb.co.com/DpJ6840

That's just the error and configs, what's the environment you're running this in?

This is correct config or not because this is issue on module node

`import i18n from 'i18next'; import en from "../local/en.json"; import Backend from 'i18next-http-backend'; import LanguageDetector from 'i18next-browser-languagedetector'; import { initReactI18next } from 'react-i18next';

i18n .use(initReactI18next) // passes i18n down to react-i18next .init({ // the translations // (tip move them in a JSON file and import them, // or even better, manage them via a UI: https://react.i18next.com/guides/multiple-translation-files#manage-your-translations-with-a-management-gui) resources: { en: { translation: { "welcome to react": "welcome to react and react-i18next" } } }, lng: "en", // if you're using a language detector, do not define the lng option fallbackLng: "en",

    interpolation: {
        escapeValue: false // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape
    }
});

export default i18n;`

maulanauls commented 2 months ago

`import i18n from 'i18next'; import en from "../local/en.json"; import Backend from 'i18next-http-backend'; import LanguageDetector from 'i18next-browser-languagedetector'; import { initReactI18next } from 'react-i18next';

i18n .use(initReactI18next) // passes i18n down to react-i18next .init({ // the translations // (tip move them in a JSON file and import them, // or even better, manage them via a UI: https://react.i18next.com/guides/multiple-translation-files#manage-your-translations-with-a-management-gui) resources: { en: { translation: { "welcome to react": "welcome to react and react-i18next" } } }, lng: "en", // if you're using a language detector, do not define the lng option fallbackLng: "en",

    interpolation: {
        escapeValue: false // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape
    }
});

export default i18n;`

This is i18n config js

adrai commented 2 months ago

Please create a minimal reproducible example repository/project on github that shows your issue.

We can't help you if you just send code snippets, sorry.

maulanauls commented 2 months ago

I will close this issue this problem because not support on "react-scripts": "2.1.2" Thank you