最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - How can I resolve strange npm run dev ✘ [ERROR] Unexpected "% issue - Stack Overflow

programmeradmin1浏览0评论

The error:


> [email protected] dev
> vite


  VITE v6.2.2  ready in 148 ms

  ➜  Local:   http://localhost:5174/
  ➜  press h + enter to show help

  LARAVEL v11.37.0  plugin v1.2.0

  ➜  APP_URL: http://localhost
✘ [ERROR] Unexpected "%"

    axios:1:0:
      1 │ %!PS-Adobe-3.0
        ╵ ^

/home/x/Desktop/Mycenic/node_modules/esbuild/lib/main.js:1477
  let error = new Error(text);
              ^

Error: Build failed with 1 error:
axios:1:0: ERROR: Unexpected "%"
    at failureErrorWithLog (/home/x/Desktop/Mycenic/node_modules/esbuild/lib/main.js:1477:15)
    at /home/x/Desktop/Mycenic/node_modules/esbuild/lib/main.js:946:25
    at /home/x/Desktop/Mycenic/node_modules/esbuild/lib/main.js:1355:9
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Node.js v22.14.0

I've tried so much to solve this issue. I've removed all the packages, reinstalled them one by one, etc.

After installing all the modules one by one I have pinned down the problem to be with

  • inertiajs/react
  • Axios

There are however npm warnings about react when running npm install Given there are so many of these I will include just a few.

npm warn While resolving: @react-spring/[email protected]
npm warn Found: [email protected]
npm warn node_modules/react
npm warn   react@"^19.0.0" from the root project
npm warn   32 more (@floating-ui/react, @floating-ui/react-dom, ...)
npm warn
npm warn Could not resolve dependency:
npm warn peer react@"^16.8.0 || ^17.0.0 || ^18.0.0" from @react-spring/[email protected]
npm warn node_modules/@react-spring/native/node_modules/@react-spring/animated
npm warn   @react-spring/animated@"~9.7.5" from @react-spring/[email protected]
npm warn   node_modules/@react-spring/native
npm warn   1 more (@react-spring/core)
npm warn
npm warn Conflicting peer dependency: [email protected]
npm warn node_modules/react
npm warn   peer react@"^16.8.0 || ^17.0.0 || ^18.0.0" from @react-spring/[email protected]
npm warn   node_modules/@react-spring/native/node_modules/@react-spring/animated
npm warn     @react-spring/animated@"~9.7.5" from @react-spring/[email protected]
npm warn     node_modules/@react-spring/native
npm warn     1 more (@react-spring/core)
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: @react-spring/[email protected]
npm warn Found: [email protected]
npm warn node_modules/react
npm warn   react@"^19.0.0" from the root project
npm warn   32 more (@floating-ui/react, @floating-ui/react-dom, ...)

Here is my package.json

  "devDependencies": {
    "@vitejs/plugin-react": "^4.3.4"
  },
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "@headlessui/react": "^2.2.0",
    "@inertiajs/react": "^2.0.5",
    "framer-motion": "^12.5.0",
    "hamburger-react": "^2.5.2",
    "laravel-vite-plugin": "^1.2.0",
    "lenis": "^1.2.3",
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "react-icons": "^5.5.0",
    "react-router-dom": "^7.3.0",
    "react-toastify": "^11.0.5",
    "react-toggle-dark-mode": "^1.1.1",
    "sweetalert2": "^11.17.2",
    "swiper": "^11.2.5",
    "tailwindcss

What is the best course of action to resolve this issue I can't even run my project with resolving this. Thank you for the help.

发布评论

评论列表(0)

  1. 暂无评论