0
Failed to compile.

./node_modules/plyr/dist/plyr.min.js 1947:29
Module parse failed: Unexpected token (1947:29)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|         let e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|         if (e ? _this2.scrollPosition = {
>           x: window.scrollX ?? 0,
|           y: window.scrollY ?? 0
|         } : window.scrollTo(_this2.scrollPosition.x, _this2.scrollPosition.y), document.body.style.overflow = e ? "hidden" : "", R(_this2.target, _this2.player.config.classNames.fullscreen.fallback, e), M.isIos) {

When i run my projuct "npm start", then this error is coming, i tried delete "node_modules" and installed "npm install" but still getting this error, can any one please help me.

My react version is: 18.0.0 Node: v16.13.0 Npm v: 8.1.0

monim
  • 3,641
  • 2
  • 10
  • 25
Baiju
  • 61
  • 2

2 Answers2

0

Step-1: Run the following command to clear the npm cache:

npm cache clean --force

Step-2: Delete the "package-lock.json" file from your project directory.

Step-3: Reinstall dependencies by running following command:

npm install
Maulik Patel
  • 344
  • 1
  • 10
0

Update your tsconfig.json file . and make sure the target property is set to ES5 :

"compilerOptions": {
    "target": "es5", //this line 
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],

And make sure the jsx property is set to react-jsx : "jsx": "react-jsx"

NOTE : make sure you're using latest version of react-scripts(v5)

monim
  • 3,641
  • 2
  • 10
  • 25
  • { "compilerOptions": { "target": "es5", "lib": [ "dom", "dom.iterable", "esnext" ], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, "noFallthroughCasesInSwitch": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "react-jsx" }, "include": [ "src" ] } – Baiju May 27 '23 at 11:10
  • Hi, monim And my react script version is: "react-scripts": "4.0.3", – Baiju May 27 '23 at 11:10
  • could you try adding : **"browserslist": [ ">0.2%", "not dead", "not op_mini all"],** to your **package.json** – monim May 27 '23 at 11:29
  • Yes, "production": [ ">0.2%", "not dead", "not op_mini all" ], – Baiju May 29 '23 at 10:36
  • Not production but browserlist – monim May 29 '23 at 13:51
  • "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, – Baiju May 30 '23 at 03:20