Error: Unsupported platform: freebsd
Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
yarn info v1.22.18
{
name: 'my-app',
description: 'my-app',
'dist-tags': { latest: '0.1.0' },
versions: [ '0.1.0' ],
maintainers: [ { name: 'mdathrika', email: '[email protected]' }
time: {
modified: '2022-06-20T15:34:47.301Z',
created: '2013-05-30T19:30:56.012Z',
'0.1.0': '2013-05-30T19:30:58.974Z'
},
users: {
'enas-443': true
},
version: '0.1.0',
scripts: {
start: 'node server.js'
},
license: 'Apache License 2.0',
dependencies: {
raptor: '>=2.3.0',
optimist: '~0.3.5',
'express-raptor': '~0.1.2',
express: '~3.1.1',
request: '~2.16.6',
'ebay-global-header': 'git://github.scm.corp.ebay.com/cubejs-ebay/ebay-global-header-node.git',
'raptor-optimizer-ready-plugin': 'git://github.scm.corp.ebay.com/cubejs-ebay/raptor-optimizer-ready-plugin.git',
'ebay-ui-components': 'git://github.scm.corp.ebay.com/Raptor/RaptorUIComponents.git',
'raptor-hot-reload': '~0.1.3',
'socket.io': '~0.9.14',
cluster2: 'git://github.scm.corp.ebay.com/cubejs/cluster2.git',
'context-config': 'git://github.scm.corp.ebay.com/cubejs/context-config-node.git',
'raptor-config': 'git://github.scm.corp.ebay.com/cubejs-ebay/raptor-config-node.git'
},
devDependencies: {},
readmeFilename: 'README.md',
dist: {
shasum: '495332e31a4fa9bca5e100798f7cfb30663c73ad',
tarball: 'https://registry.npmjs.org/my-app/-/my-app-0.1.0.tgz',
integrity: 'sha512-CLIDEWQdnm3x96rWAQgm9u+jorK1KdGN9SC1qoyHuEc3KyKIw1NJ6fQ3p1NzDMPSpVt01ojiUbtdsZuIlQ4nPQ==',
signatures: [
{
keyid: 'SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA',
sig: 'MEUCIE2UwWOiqF7h+/wy7couMhgLBPBNm3dMhi3qyVUt+MtjAiEAlMyO12Ros0SDJiQRteOCMr+mPm8mtDGDmAn662Nkzr4='
}
]
},
directories: {}
}
Done in 1.20s.
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
yarn create next-app --typescript followed by yarn dev
Describe the Bug
Following the instructions in the getting started docs should be a simple enough affair.
But on FreeBSD it doesn't compile.
I do the automatic setup using yarn create next-app --typescript followed by yarn dev.
This throws an error
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - SWC minify release candidate enabled. https://nextjs.link/swcmin
Error: Unsupported platform: freebsd
at /usr/home/crm/new_app/my-app/node_modules/next/dist/lib/download-wasm-swc.js:84:31
at Object.downloadWasmSwc (/usr/home/crm/new_app/my-app/node_modules/next/dist/lib/download-wasm-swc.js:98:7)
at async /usr/home/crm/new_app/my-app/node_modules/next/dist/build/swc/index.js:114:13
Done in 3.22s.
$
)
I try also by disabling swcMinify in next.config.js. The Error is the same.
There were past issues about this and they were marked closed, so I assumed this would have been resolved by now.
Expected Behavior
yarn dev should succeed.
Link to reproduction
Just follow the instructions in the getting started guide.
To Reproduce
Just follow the instructions in the getting started guide.
https://github.com/vercel/next.js/issues/36639 concluded that it had been fixed in the canary release over a month back. So a bit surprising this still happens. And with an explicit error message that the OS is not supported.
This error comes from node_modules/next/dist/lib/download-wasm-swc.js because the cache file location is not specified for FreeBSD. That's easily solvable by adding something like
else if (process.platform === "freebsd") { systemCacheDirectory = _path.default.join(_os.default.homedir(), ".cache");
in the block where cache directory locations are being set for Linux, Darwin, Windows.
After fixing this next dev actually starts to work.
next build though, breaks badly.
$ next build
info - SWC minify release candidate enabled. https://nextjs.link/swcmin
info - Linting and checking validity of types
info - Using experimental wasm build of next-swc
warn - Attempted to load @next/swc-freebsd-x64, but an error occurred: /lib/libc.so.7: version FBSD_1.7 required by /usr/home/an/toobr/new_app/bugfix/node_modules/@next/swc-freebsd-x64/next-swc.freebsd-x64.node not found
panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: IOError(Error { kind: Unsupported, message: "operation not supported on this platform" }) }', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:170:10
Stack:
Error
at module.exports.__wbg_new_693216e109162396 (/usr/home/an/toobr/new_app/bugfix/node_modules/next/wasm/@next/swc-wasm-nodejs/wasm.js:202:17)
at wasm://wasm/05e8633a:wasm-function[6129]:0x11550b7
at wasm://wasm/05e8633a:wasm-function[14808]:0x142e83b
at wasm://wasm/05e8633a:wasm-function[11897]:0x13dbf20
at wasm://wasm/05e8633a:wasm-function[12932]:0x140d499
at wasm://wasm/05e8633a:wasm-function[13945]:0x14286cb
at wasm://wasm/05e8633a:wasm-function[13327]:0x141ae89
at wasm://wasm/05e8633a:wasm-function[11923]:0x13dd62e
at wasm://wasm/05e8633a:wasm-function[1264]:0xa87abb
at wasm://wasm/05e8633a:wasm-function[710]:0x81186b
info - Creating an optimized production build
Failed to compile.
static/chunks/framework-2e315a3383098fda.js from Terser
unreachable
RuntimeError: unreachable
at wasm://wasm/05e8633a:wasm-function[11897]:0x13dbf43
at wasm://wasm/05e8633a:wasm-function[12932]:0x140d499
at wasm://wasm/05e8633a:wasm-function[13945]:0x14286cb
at wasm://wasm/05e8633a:wasm-function[13327]:0x141ae89
at wasm://wasm/05e8633a:wasm-function[11923]:0x13dd62e
at wasm://wasm/05e8633a:wasm-function[1264]:0xa87abb
at wasm://wasm/05e8633a:wasm-function[710]:0x81186b
at wasm://wasm/05e8633a:wasm-function[710]:0x812511
at wasm://wasm/05e8633a:wasm-function[3846]:0xf4b28f
at wasm://wasm/05e8633a:wasm-function[710]:0x8116c7
> Build failed because of webpack errors
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The directory location mentioned in text of the panic message (pasting again below) indicates either a MacOS location is hard coded, or it is treating FreeBSD and MacOS identically.
panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: IOError(Error { kind: Unsupported, message: "operation not supported on this platform" }) }', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:170:10
This definitely needs a closer look.
Or perhaps, SWC won't actually work here, so FreeBSD users should spare themselves the trouble and just use Babel.
@kdy1 Not sure if this should be opened in the swc repo, but it sure seems relevant.
This is a parcel issue.
Experiencing the same thing with Gatsby (our build machines all use FreeBSD so this is causing major headaches for us as we have to temporarily resort to low performance hypervisor builds). Can someone notify the relevant devs that FreeBSD still exists?
Hi, I believe the wasm fallback should have been fixed in a later release, could you give it a try by upgrading with yarn add next@canary?
On the other hand, there should be a native binary still for freebsd. To verify, could you provide a full reproduction (like a public repository) so we can figure out why it is not loaded for you?
This issue has been automatically closed because it received no activity for a month and had no reproduction to investigate. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.