LunaTMT's avatar

npm run dev [ERROR] Unexpected "%"

Could someone please help me figure out how to go about solving this issue. My project was running absolutely fine yesterday. When i boot it up today using docker, I am having npm issues.

npm run dev

dev vite

VITE v6.2.2 ready in 188 ms

➜ Local:
➜ press h + enter to show help

LARAVEL v11.37.0 plugin v1.2.0

➜ APP_URL: ✘ [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/taylor/Desktop/Mycenic/node_modules/esbuild/lib/main.js:1477:15) at /home/taylor/Desktop/Mycenic/node_modules/esbuild/lib/main.js:946:25 at /home/taylor/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 do not have any high vulnerability issues

x@x-Z170MX-Gaming-5:~/Desktop/Mycenic$ npm audit

npm audit report

sweetalert2 >=11.6.14 sweetalert2 v11.6.14 and above contains potentially undesirable behavior - fix available via npm audit fix node_modules/sweetalert2

1 low severity vulnerability

To address all issues, run: npm audit fix

0 likes
5 replies
RemiM's avatar

Most likely an issue with a NPM package.

Try deleting node_modules and reinstalling:

rm -rf node_modules package-lock.json
npm install
LunaTMT's avatar

@RemiM I have tried this already and still get the same problem.

However when I run npm install after removing everything there is a lot of npm warn messages about react

Unfortunately, same error:

RemiM's avatar

Well, it looks like you have two problems:

The first one after runing npm installshows that you are using React 19, but some dependencies like react-dom are expecting the version 18.3.1.

You have two options:

  1. Downgrade React to version 18.
  2. Updating the dependencies like react-dom to use React 19.

The second error might be fixed after the first is resolve.

Eventually you can share your package.json file if you want further exploration.

LunaTMT's avatar

@RemiM

Following these two steps certainly minimised the amount of NPM warnings. There seems to only be three now.

running npm run dev however still contains the same strange axios error. I am completely pulling my hair out with this one. Truly don't know how to fix this. I've tried removing axios, installing the latest, etc, but nothing works.

I also completely forgot about sharing the package.json file. Thanks for reminding me.

RemiM's avatar

@LunaTMT

I believe the issue comes from headlessui/react's peer dependencies floating-ui.

  1. Clean your current files:
rm -rf node_modules package-lock.json
  1. Update your main React dependencies:
npm install react@latest react-dom@latest @headlessui/react@latest

Now, when you run your command npm run devit should work correctly.

If the issue persists with other dependencies, try updating them with their latest available versions.

Please or to participate in this conversation.