[ERROR] Could not resolve "fast-xml-parser"
ignaciolarranaga opened this issue · comments
To reproduce
npx create-next-app@latest
cd my-app
npx create-sst@latest
npm install
npx sst deploy
Note: In all the cases used the defaults
And the error that happens:
✘ [ERROR] Could not resolve "fast-xml-parser"
../../../Users/ignacio/.npm/_npx/6fd3fdda1aa7f7f3/node_modules/@aws-sdk/core/dist-cjs/index.js:372:37:
372 │ var import_fast_xml_parser = require("fast-xml-parser");
╵ ~~~~~~~~~~~~~~~~~
You can mark the path "fast-xml-parser" as external to exclude it from the bundle, which will
remove this error. You can also surround this "require" call with a try/catch block to handle this
failure at run-time instead of bundle-time.
/Users/ignacio/.npm/_npx/6fd3fdda1aa7f7f3/node_modules/esbuild/lib/main.js:1649
let error = new Error(text);
^
Error: Build failed with 1 error:
../../../Users/ignacio/.npm/_npx/6fd3fdda1aa7f7f3/node_modules/@aws-sdk/core/dist-cjs/index.js:372:37: ERROR: Could not resolve "fast-xml-parser"
at failureErrorWithLog (/Users/ignacio/.npm/_npx/6fd3fdda1aa7f7f3/node_modules/esbuild/lib/main.js:1649:15)
at /Users/ignacio/.npm/_npx/6fd3fdda1aa7f7f3/node_modules/esbuild/lib/main.js:1058:25
at runOnEndCallbacks (/Users/ignacio/.npm/_npx/6fd3fdda1aa7f7f3/node_modules/esbuild/lib/main.js:1484:45)
at buildResponseToResult (/Users/ignacio/.npm/_npx/6fd3fdda1aa7f7f3/node_modules/esbuild/lib/main.js:1056:7)
at /Users/ignacio/.npm/_npx/6fd3fdda1aa7f7f3/node_modules/esbuild/lib/main.js:1085:16
at responseCallbacks.<computed> (/Users/ignacio/.npm/_npx/6fd3fdda1aa7f7f3/node_modules/esbuild/lib/main.js:703:9)
at handleIncomingPacket (/Users/ignacio/.npm/_npx/6fd3fdda1aa7f7f3/node_modules/esbuild/lib/main.js:762:9)
at Socket.readFromStdout (/Users/ignacio/.npm/_npx/6fd3fdda1aa7f7f3/node_modules/esbuild/lib/main.js:679:7)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:368:12) {
errors: [Getter/Setter],
warnings: [Getter/Setter]
}
Node.js v18.19.0
Error: There was a problem building the "site" site.
Workaround on aws-sdk-js-v3
I also tried to apply this: aws/aws-sdk-js-v3#5866 (comment) without success.
npm add @aws-sdk/client-s3
npx sst deploy
Same error again.
Workaround directly adding fast-xml-parser
I also tried to directly add fast-xml-parser
npm add fast-xml-parser
npx sst deploy
Same error again.
Discord link: https://discord.com/channels/983865673656705025/1145967640595148803/1215594523997118545
If using npm
rm -rf node_modules package-lock.json
npm install
If using yarn
yarn cache clean
rm -rf node_modules yarn.lock
yarn install
Can you please remove caches and node_modules, .sst , .next everything and try again
Thanks @rokasta12, I tried that, I think the final solution was npm cache clean --force
(there was something cached in my npm user cache - more details in the discord)