next.js: Unable to download swc package - Next.js project in Android Termux
Link to the code that reproduces this issue
https://github.com/Clever-Shivanshu/file-upload-api
To Reproduce
- Start the Application by npm run dev
- Visit localhost:3000/api/fileUpload
- It crashes in Android termux after it
Current vs. Expected behavior
I am getting trying to create a api which takes files and save in public/uploads
But when go to http://localhost:3000/api/fileUpload
It crashes and getting this `$ npm run dev
file-upload@0.1.0 dev next dev
▲ Next.js 14.0.2
- Local: http://localhost:3000
Disabled SWC as replacement for Babel because of custom Babel configuration “.babelrc” https://nextjs.org/docs/messages/swc-disabled ✓ Ready in 5.6s ⚠ Attempted to load @next/swc-android-arm64, but it was not installed ⚠ Found lockfile missing swc dependencies, patching… ⨯ Failed to patch lockfile, please try uninstalling and reinstalling next in this workspace TypeError: fetch failed at Object.fetch (node:internal/deps/undici/undici:11522:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async fetchPkgInfo (/data/data/com.termux/files/home/file-upload-api/node_modules/next/dist/lib/patch-incorrect-lockfile.js:64:17) at async Promise.all (index 0) at async patchIncorrectLockfile (/data/data/com.termux/files/home/file-upload-api/node_modules/next/dist/lib/patch-incorrect-lockfile.js:160:26) { cause: Error [ERR_SOCKET_CONNECTION_TIMEOUT]: Socket connection timeout at new NodeError (node:internal/errors:399:5) at internalConnectMultiple (node:net:1099:20) at Timeout.internalConnectMultipleTimeout (node:net:1638:3) at listOnTimeout (node:internal/timers:575:11) at process.processTimers (node:internal/timers:514:7) { code: ‘ERR_SOCKET_CONNECTION_TIMEOUT’ } } ⨯ Failed to load SWC binary for android/arm64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc`
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
OS: Android 13
App: termux
Which area(s) are affected? (Select all that apply)
SWC minifier (swcMinify: true)
Additional context
I tried to fix it but not working
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 18
- Comments: 53
I also faced the same issue. I’m getting an error like
Downloading swc package @next/swc-android-arm64... ⨯ Failed to download swc package from https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-14.0.4.tgz Error: request failed with status 404Is there any solution or workaround? Any help is appreciated.
The solution is to install a linux distribution using
proot-distro. Here are the steps:proot-distro.ubuntu.What about cpu which are arm only not arm64 I tried installing @next/swc-android-arm-eabi And it got installed now when i am starting the server the server get start for 2secs and exit without any error
Looking at the @next/swc-android-arm64 package on the NPM registry, the latest version is 13.2.4.
This appears to be tied to the NextJS version. If you downgrade to that NextJS version, the download should be successful.
Looks like the releases are usually published by the vercel-release-bot, so someone from Vercel will likely need to have this built and published for the 14.x releases.
+1. I also get this issue
Just run following command it Will fix the issue
npm i @next/swc-android-arm64
I found a way to fix the 404 Error for SWC downloading.
npx create-next-app@latestnpm installcd node_modules/next/dist/build/swcconst nextVersion = "13.2.4";This error occurs because the SWC package hasn’t been update since version 13.
See @next/swc-android-arm-eabi
Here are the steps
pkg install proot-distroproot-distro install ubuntuproot-distro login ubuntuapt install nodejspkg install npmpkg install ghgh auth loginMore infocd ../home ; mkdir code ; cd codeCreate folder in home foldergh repo clone username/repoClone repository. Replace with github user and repository name4 . Movement of truth
cd repoReplace with repository folder namenpm installnpm run devPlz kindly reopen this the issues This solution need installation of Ubuntu It would be good if we find a solution for termux only The possible issues has already been given by community. I request @vercel to fix this problem as soon as possible
Hi I tried nextjs 15.0.0-rc and next installed
@next/swc-wasm-nodejspackage rather than@next/swc-android-arm64and this works now!!I also have this problem on Linux Bookworm with Bash terminal. The url that gets the 404 is https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-14.0.4.tgz
Tyyyyyyyy❤️❤️
I use this method and make it successful! Thanks.
This work perfectly for me, thanks alot
Another solution, try next13
@Jobians , thanks a lot for giving me a solution. It means a lot to me .
Working and tested solution: using Ubuntu
Install Ubuntu:
After installation login to Ubuntu and do the npx stuff.
Edit: If npx command not responding, try use VPN.
to install proot-distro? nope!
Thanks the answer was to use proot and installed nvm, then cd into your next.js project and create an .nvmrc with the version of node. You can use
nvm install --ltsto install the latest LTS version. npm install, npm build - this time build doesn’t fail due to missing swc.Try npm in proot debian or Ubuntu