Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to download swc package - Next.js project in Android Termux #58483

Open
1 task done
Clever-Shivanshu opened this issue Nov 15, 2023 · 44 comments
Open
1 task done
Labels
bug Issue was opened via the bug report template. SWC Related to minification/transpilation in Next.js.

Comments

@Clever-Shivanshu
Copy link

Link to the code that reproduces this issue

https://github.com/Clever-Shivanshu/file-upload-api

To Reproduce

  1. Start the Application by npm run dev
  2. Visit localhost:3000/api/fileUpload
  3. 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

[email protected] dev
next dev

▲ Next.js 14.0.2

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

@Clever-Shivanshu Clever-Shivanshu added the bug Issue was opened via the bug report template. label Nov 15, 2023
@budchirp
Copy link

I also have that issue. NextJS was working perfectly before version 14 now I get this error: ⨯ Failed to download swc package from https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-14.0.3.tgz
Error: request failed with status 404

@Clever-Shivanshu
Copy link
Author

@budchirp do you got solution

@Clever-Shivanshu
Copy link
Author

@vercel fix it

@aritraanish
Copy link

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 404

Is there any solution or workaround? Any help is appreciated.
Screenshot_2023-12-14-16-51-05-23_84d3000e3f4017145260f7618db1d683

@campbellgoe
Copy link

I'm getting the same 404 error when in ubuntu 22 proot termux.

@agcrisbp
Copy link

agcrisbp commented Jan 1, 2024

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 404

Is there any solution or workaround? Any help is appreciated. Screenshot_2023-12-14-16-51-05-23_84d3000e3f4017145260f7618db1d683

1. I also get this issue

@quietCoder500
Copy link

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

@Dimeji-go
Copy link

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

@campbellgoe
Copy link

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

@Dimeji-go
Copy link

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

@campbellgoe
Copy link

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

This is what I get:

root@localhost:~/projects/next-canvas# yarn build
yarn run v1.22.19
$ next build
▲ Next.js 14.0.4

Downloading swc package @next/swc-android-arm64...
⨯ Failed to download swc package from https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-14.0.4.tgz
unhandledRejection Error: request failed with status 404
at /root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:96:23
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async extractBinary (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:90:9)
at async downloadNativeNextSwc (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:151:9)
at async tryLoadNativeWithFallback (/root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:291:5)
at async /root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:275:40
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
root@localhost:~/projects/next-canvas# rustc --version
rustc 1.75.0 (82e1608df 2023-12-21)

@agcrisbp
Copy link

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

This is what I get:

root@localhost:~/projects/next-canvas# yarn build yarn run v1.22.19 $ next build ▲ Next.js 14.0.4

Downloading swc package @next/swc-android-arm64... ⨯ Failed to download swc package from https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-14.0.4.tgz unhandledRejection Error: request failed with status 404 at /root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:96:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async extractBinary (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:90:9) at async downloadNativeNextSwc (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:151:9) at async tryLoadNativeWithFallback (/root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:291:5) at async /root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:275:40 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. root@localhost:~/projects/next-canvas# rustc --version rustc 1.75.0 (82e1608df 2023-12-21)

what your node & npm version? I use proot-ubuntu and works fine.

@Dimeji-go
Copy link

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

This is what I get:

root@localhost:~/projects/next-canvas# yarn build yarn run v1.22.19 $ next build ▲ Next.js 14.0.4

Downloading swc package @next/swc-android-arm64... ⨯ Failed to download swc package from https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-14.0.4.tgz unhandledRejection Error: request failed with status 404 at /root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:96:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async extractBinary (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:90:9) at async downloadNativeNextSwc (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:151:9) at async tryLoadNativeWithFallback (/root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:291:5) at async /root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:275:40 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. root@localhost:~/projects/next-canvas# rustc --version rustc 1.75.0 (82e1608df 2023-12-21)

Try npm in proot debian or Ubuntu

@agcrisbp
Copy link

agcrisbp commented Jan 28, 2024

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

This is what I get:
root@localhost:/projects/next-canvas# yarn build yarn run v1.22.19 $ next build ▲ Next.js 14.0.4
Downloading swc package @next/swc-android-arm64... ⨯ Failed to download swc package from https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-14.0.4.tgz unhandledRejection Error: request failed with status 404 at /root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:96:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async extractBinary (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:90:9) at async downloadNativeNextSwc (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:151:9) at async tryLoadNativeWithFallback (/root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:291:5) at async /root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:275:40 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. root@localhost:
/projects/next-canvas# rustc --version rustc 1.75.0 (82e1608df 2023-12-21)

Try npm in proot debian or Ubuntu

if you use Proot, install nodejs and npm latest version using nvm.

image

image

@Clever-Shivanshu
Copy link
Author

bro this doesn't work in termux android

@agcrisbp
Copy link

bro this doesn't work in termux android

install proot-distro in Termux then.

@campbellgoe
Copy link

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 --lts to install the latest LTS version. npm install, npm build - this time build doesn't fail due to missing swc.

@budchirp
Copy link

bro this doesn't work in termux android

install proot-distro in Termux then.

proot should not be the solution. more libraries and tools should support Android.

@clee231
Copy link

clee231 commented Feb 14, 2024

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.

@templar-ajay
Copy link

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

Does the Android device have to be rooted ?

@agcrisbp
Copy link

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

Does the Android device have to be rooted ?

to install proot-distro? nope!

@avshyz
Copy link

avshyz commented Feb 27, 2024

@clee231 I've also come to the same conclusion
In my case, I was trying to run an next app on a raspberry pie, couldn't opt out of swc, and couldn't install its binary, and the only thing that did help was downgrading next to be on par with swc's version (@swc/core-linux-arm-gnueabihf in my case)

Do you know what should we do to notify the maintainers of vercel to build those packages?

@Clever-Shivanshu
Copy link
Author

@vercel team please respond

@zFitness
Copy link

zFitness commented Apr 3, 2024

image * please update the package to v14

@Clever-Shivanshu
Copy link
Author

image * please update the package to v14

Thank you sir for doing this

@balazsorban44 balazsorban44 added SWC Related to minification/transpilation in Next.js. and removed area: SWC Minify labels Apr 17, 2024
@syedshafique
Copy link

Just run following command it Will fix the issue

npm i @next/swc-android-arm64

@anishdevtech
Copy link

anishdevtech commented May 3, 2024

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

@mahmood601
Copy link

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

This is what I get:

root@localhost:~/projects/next-canvas# yarn build yarn run v1.22.19 $ next build ▲ Next.js 14.0.4

Downloading swc package @next/swc-android-arm64... ⨯ Failed to download swc package from https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-14.0.4.tgz unhandledRejection Error: request failed with status 404 at /root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:96:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async extractBinary (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:90:9) at async downloadNativeNextSwc (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:151:9) at async tryLoadNativeWithFallback (/root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:291:5) at async /root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:275:40 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. root@localhost:~/projects/next-canvas# rustc --version rustc 1.75.0 (82e1608df 2023-12-21)

Hi I tried nextjs 15.0.0-rc and next installed @next/swc-wasm-nodejs package rather than @next/swc-android-arm64 and this works now!!

@Park-Jongseok
Copy link

Park-Jongseok commented Jun 11, 2024

I don't think this is the right answer, but if you're developing in a local environment and want to get it up and running on Termux, build it locally, transfer it to something like SCP, and run it into production on Termux.

npm run build
scp -P <PORT> -r .next public package.json package-lock.json id@ip://...

Here's the script we ran on Termux

npm i --omit=dev
npm run start

My package.json looks like this

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "^15.0.0-rc.0",
    "react": "^19.0.0-rc-6230622a1a-20240610",
    "react-dom": "^19.0.0-rc-6230622a1a-20240610"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "eslint": "^8",
    "eslint-config-next": "^15.0.0-rc.0",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}

image
image

@anishdevtech
Copy link

anishdevtech commented Jun 25, 2024

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

This is what I get:
root@localhost:/projects/next-canvas# yarn build yarn run v1.22.19 $ next build ▲ Next.js 14.0.4
Downloading swc package @next/swc-android-arm64... ⨯ Failed to download swc package from https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-14.0.4.tgz unhandledRejection Error: request failed with status 404 at /root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:96:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async extractBinary (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:90:9) at async downloadNativeNextSwc (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:151:9) at async tryLoadNativeWithFallback (/root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:291:5) at async /root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:275:40 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. root@localhost:
/projects/next-canvas# rustc --version rustc 1.75.0 (82e1608df 2023-12-21)

Hi I tried nextjs 15.0.0-rc and next installed @next/swc-wasm-nodejs package rather than @next/swc-android-arm64 and this works now!!

THT IS NOT WORKING FOR ME BECAUSE IT IS ATTEMPTING TO INSTAL next/sws-andriod-arm64 also

next dev --turbo

  ▲ Next.js 15.0.0-rc.0 (turbo)
  - Local:        http://localhost:3000
  - Experiments (use with caution):
    · ppr
    · reactCompiler

 ✓ Starting...
 ⚠ Attempted to load @next/swc-android-arm-eabi, but it was not installed
TypeError: bindings.turbo.createProject is not a function
    at createHotReloaderTurbopack (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/dev/hot-reloader-turbopack.js:105:42)
    at async startWatcher (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js:144:38)
    at async setupDevBundler (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js:769:20)
    at async Span.traceAsyncFn (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/trace/trace.js:157:20)
    at async initialize (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/router-server.js:79:30)
    at async Server.<anonymous> (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/start-server.js:250:36)

If I install sws-andriod-arm64 then the issue is it doesn't support arm but support arm64 if I use --force to install tht then my nextjs app start but exist after 2sec
@balazsorban44 fix this plz or give some solution

@Jobians
Copy link

Jobians commented Jun 29, 2024

Working and tested solution: using Ubuntu

Screenshot_2024-06-30-00-25-02-55_84d3000e3f4017145260f7618db1d683

Install Ubuntu:

pkg update -y && pkg install wget curl proot tar -y && wget https://raw.githubusercontent.com/AndronixApp/AndronixOrigin/master/Installer/Ubuntu22/ubuntu22.sh -O ubuntu22.sh && chmod  x ubuntu22.sh && bash ubuntu22.sh

After installation login to Ubuntu and do the npx stuff.

Edit:
If npx command not responding, try use VPN.

@Clever-Shivanshu
Copy link
Author

@Jobians , thanks a lot for giving me a solution. It means a lot to me .

@anishdevtech
Copy link

Plz 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

@Jobians
Copy link

Jobians commented Jul 2, 2024

@anishdevtech Bro, this issue isn't related to Next.js or Vercel. The problem lies with the Rust compiler package required by Termux, which can't run directly on Termux. That's why I installed Ubuntu.

@neilzhang618
Copy link

neilzhang618 commented Jul 11, 2024

Hi @anishdevtech I have the same issue with you.

I followed this instruction: https://nextjs.org/docs/messages/failed-loading-swc

But I failed.

I want to know why nextjs still try to load SWC even though I have already disabled SWC by setting next.config.js

image

@Clever-Shivanshu
Copy link
Author

@anishdevtech

@anishdevtech
Copy link

Hi @anishdevtech I have the same issue with you.

I followed this instruction: https://nextjs.org/docs/messages/failed-loading-swc

But I failed.

I want to know why nextjs still try to load SWC even though I have already disabled SWC by setting next.config.js

image

I will look into this issue
And try to get a solution asap

@sabeerbikba
Copy link

sabeerbikba commented Jul 18, 2024

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

This is what I get:
root@localhost:/projects/next-canvas# yarn build yarn run v1.22.19 $ next build ▲ Next.js 14.0.4
Downloading swc package @next/swc-android-arm64... ⨯ Failed to download swc package from https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-14.0.4.tgz unhandledRejection Error: request failed with status 404 at /root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:96:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async extractBinary (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:90:9) at async downloadNativeNextSwc (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:151:9) at async tryLoadNativeWithFallback (/root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:291:5) at async /root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:275:40 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. root@localhost:
/projects/next-canvas# rustc --version rustc 1.75.0 (82e1608df 2023-12-21)

Try npm in proot debian or Ubuntu

Here are the steps

  1. Install proot-distro and login
  • pkg install proot-distro
  • proot-distro install ubuntu
  • proot-distro login ubuntu
  1. Install necessary packages
  • apt install nodejs
  • pkg install npm
  • pkg install gh
  1. Login GitHub CLI and clone repo
  • gh auth login More info
  • cd ../home ; mkdir code ; cd code Create folder in home folder
  • gh repo clone username/repo Clone repository. Replace with github user and repository name

4 . Movement of truth

  • cd repo Replace with repository folder name
  • npm install
  • npm run dev

@mahmood601
Copy link

mahmood601 commented Jul 23, 2024

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

This is what I get:
root@localhost:/projects/next-canvas# yarn build yarn run v1.22.19 $ next build ▲ Next.js 14.0.4
Downloading swc package @next/swc-android-arm64... ⨯ Failed to download swc package from https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-14.0.4.tgz unhandledRejection Error: request failed with status 404 at /root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:96:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async extractBinary (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:90:9) at async downloadNativeNextSwc (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:151:9) at async tryLoadNativeWithFallback (/root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:291:5) at async /root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:275:40 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. root@localhost:
/projects/next-canvas# rustc --version rustc 1.75.0 (82e1608df 2023-12-21)

Hi I tried nextjs 15.0.0-rc and next installed @next/swc-wasm-nodejs package rather than @next/swc-android-arm64 and this works now!!

THT IS NOT WORKING FOR ME BECAUSE IT IS ATTEMPTING TO INSTAL next/sws-andriod-arm64 also

next dev --turbo

  ▲ Next.js 15.0.0-rc.0 (turbo)
  - Local:        http://localhost:3000
  - Experiments (use with caution):
    · ppr
    · reactCompiler

 ✓ Starting...
 ⚠ Attempted to load @next/swc-android-arm-eabi, but it was not installed
TypeError: bindings.turbo.createProject is not a function
    at createHotReloaderTurbopack (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/dev/hot-reloader-turbopack.js:105:42)
    at async startWatcher (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js:144:38)
    at async setupDevBundler (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js:769:20)
    at async Span.traceAsyncFn (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/trace/trace.js:157:20)
    at async initialize (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/router-server.js:79:30)
    at async Server.<anonymous> (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/start-server.js:250:36)

If I install sws-andriod-arm64 then the issue is it doesn't support arm but support arm64 if I use --force to install tht then my nextjs app start but exist after 2sec @balazsorban44 fix this plz or give some solution

I didn't use turbo package, it wasn't available on termux

@mahmood601
Copy link

@anishdevtech
Look
Screenshot_20240723-134931

@sabeerbikba
Copy link

sabeerbikba commented Jul 23, 2024

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

This is what I get:
root@localhost:/projects/next-canvas# yarn build yarn run v1.22.19 $ next build ▲ Next.js 14.0.4
Downloading swc package @next/swc-android-arm64... ⨯ Failed to download swc package from https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-14.0.4.tgz unhandledRejection Error: request failed with status 404 at /root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:96:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async extractBinary (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:90:9) at async downloadNativeNextSwc (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:151:9) at async tryLoadNativeWithFallback (/root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:291:5) at async /root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:275:40 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. root@localhost:
/projects/next-canvas# rustc --version rustc 1.75.0 (82e1608df 2023-12-21)

Hi I tried nextjs 15.0.0-rc and next installed @next/swc-wasm-nodejs package rather than @next/swc-android-arm64 and this works now!!

THT IS NOT WORKING FOR ME BECAUSE IT IS ATTEMPTING TO INSTAL next/sws-andriod-arm64 also

next dev --turbo

  ▲ Next.js 15.0.0-rc.0 (turbo)
  - Local:        http://localhost:3000
  - Experiments (use with caution):
    · ppr
    · reactCompiler

 ✓ Starting...
 ⚠ Attempted to load @next/swc-android-arm-eabi, but it was not installed
TypeError: bindings.turbo.createProject is not a function
    at createHotReloaderTurbopack (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/dev/hot-reloader-turbopack.js:105:42)
    at async startWatcher (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js:144:38)
    at async setupDevBundler (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js:769:20)
    at async Span.traceAsyncFn (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/trace/trace.js:157:20)
    at async initialize (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/router-server.js:79:30)
    at async Server.<anonymous> (/data/data/com.termux/files/home/WEATHER_APP/node_modules/next/dist/server/lib/start-server.js:250:36)

If I install sws-andriod-arm64 then the issue is it doesn't support arm but support arm64 if I use --force to install tht then my nextjs app start but exist after 2sec @balazsorban44 fix this plz or give some solution

I didn't use turbo package, it wasn't available on termux

Turbopack can be used for faster local development. If it causing problem remove --turbo flag from package.json file dev script.

// Before
{
  "scripts": {
    "dev": "next dev --turbo"
  }
}

// After
{
  "scripts": {
    "dev": "next dev"
  }

@Jobians
Copy link

Jobians commented Jul 28, 2024

Another solution, try next13

export NEXT_USE_BABEL=true
npx create-next-app@13 my-nextjs-13

IMG_20240728_151447_994

@pikriawan
Copy link

pikriawan commented Aug 10, 2024

The solution is to install a linux distribution using proot-distro. Here are the steps:

  1. Install proot-distro.
pkg install proot-distro
  1. Install a linux distribution, for example, ubuntu.
proot-distro install ubuntu
  1. Log in to the linux distribution.
proot-distro login ubuntu
  1. To use nodejs, install nvm.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
  1. To make the nvm command work, you need to restart the linux distribution.
exit
proot-distro login ubuntu
  1. Install nodejs using nvm.
nvm install 20
  1. Create a new Next.js project or open an existing one and run it; it should work.

Screenshot_20240810_125127_Termux

@Micheal-Repo
Copy link

I'm getting the same 404 error when in ubuntu 22 proot termux.

Install rust

I inderstand swc is built with rust but that does not help, I've installed rust and the project still gets the 404

Works for me, just install rust in any termux proot with curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and install nextjs latest version

This is what I get:
root@localhost:/projects/next-canvas# yarn build yarn run v1.22.19 $ next build ▲ Next.js 14.0.4
Downloading swc package @next/swc-android-arm64... ⨯ Failed to download swc package from https://registry.yarnpkg.com/@next/swc-android-arm64/-/swc-android-arm64-14.0.4.tgz unhandledRejection Error: request failed with status 404 at /root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:96:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async extractBinary (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:90:9) at async downloadNativeNextSwc (/root/projects/next-canvas/node_modules/next/dist/lib/download-swc.js:151:9) at async tryLoadNativeWithFallback (/root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:291:5) at async /root/projects/next-canvas/node_modules/next/dist/build/swc/index.js:275:40 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. root@localhost:
/projects/next-canvas# rustc --version rustc 1.75.0 (82e1608df 2023-12-21)

Hi I tried nextjs 15.0.0-rc and next installed @next/swc-wasm-nodejs package rather than @next/swc-android-arm64 and this works now!!

This work perfectly for me, thanks alot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. SWC Related to minification/transpilation in Next.js.
Projects
None yet
Development

No branches or pull requests