SyntaxError: Unexpected token <
Closed this issue · 1 comments
Dear author, I got these following errors when I use this tool:
$ replace-jquery "src/controller/pages/**/*.js" "out.js"
Finding jQuery function reference in src/controller/pages/activate/activate.js ...
C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\espree\lib\espree.js:190
const err = new SyntaxError(message);
^
SyntaxError: Unexpected token <
at Espree.raise (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\espree\lib\espree.js:190:25)
at Espree.unexpected (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\espree\lib\espree.js:235:18)
at pp$3.parseExprAtom (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:2326:12)
at pp$3.parseExprSubscripts (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:2129:21)
at pp$3.parseMaybeUnary (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:2106:19)
at pp$3.parseExprOps (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:2041:21)
at pp$3.parseMaybeConditional (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:2024:21)
at pp$3.parseMaybeAssign (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:1997:21)
at pp$1.parseVar (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:1239:26)
at pp$1.parseVarStatement (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:1101:10) {
index: 1021,
lineNumber: 46,
column: 23
}
Node.js v18.15.0
I am wondering what should I do? Downgrade Node.js version?
I downgraded Node.js to 14.0.0, it didn't work as well. Error messages are as follows:
$ replace-jquery "src/controller/pages/**/*.js" "out.js"
Finding jQuery function reference in src/controller/pages/activate/activate.js ...
(node:12428) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token <
at Espree.raise (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\espree\lib\espree.js:190:25)
at Espree.unexpected (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\espree\lib\espree.js:235:18)
at Espree.pp$3.parseExprAtom (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:2326:12)
at Espree.pp$3.parseExprSubscripts (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:2129:21)
at Espree.pp$3.parseMaybeUnary (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:2106:19)
at Espree.pp$3.parseExprOps (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:2041:21)
at Espree.pp$3.parseMaybeConditional (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:2024:21)
at Espree.pp$3.parseMaybeAssign (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:1997:21)
at Espree.pp$1.parseVar (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:1239:26)
at Espree.pp$1.parseVarStatement (C:\Users\Administrator\AppData\Roaming\npm\node_modules\replace-jquery\node_modules\acorn\dist\acorn.js:1101:10)
(Use node --trace-warnings ...
to show where the warning was created)
(node:12428) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:12428) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.