bombillazo
bombillazo•15mo ago

Deno compile target error

Hello, I am trying to compile a Deno api using deno --unstable ./path/to/api/index.ts --output ./path/to/output/api but am getting the following error:
Compile file:///Users/user/Projects/Code/app/functions/api/index.ts to ./functions/.build/api
Archive: /var/folders/kp/brk5wgsn5mz73fxhj06c9tdw0000gn/T/.tmpnxgwN8/deno.zip
inflating: deno
error: Writing ./functions/.build/api

Caused by:
0: Reading symlink /Users/user/Projects/Code/app/node_modules/.deno/next@13.5.4/node_modules/@next/swc-linux-arm64-gnu
1: No such file or directory (os error 2)
Compile file:///Users/user/Projects/Code/app/functions/api/index.ts to ./functions/.build/api
Archive: /var/folders/kp/brk5wgsn5mz73fxhj06c9tdw0000gn/T/.tmpnxgwN8/deno.zip
inflating: deno
error: Writing ./functions/.build/api

Caused by:
0: Reading symlink /Users/user/Projects/Code/app/node_modules/.deno/next@13.5.4/node_modules/@next/swc-linux-arm64-gnu
1: No such file or directory (os error 2)
I also tried with --target aarch64-apple-darwin to no avail. I see that the that the @next/swc-linux-arm64-gnu package is missing while the deno supported platform are present (see image). Why is the @next dependency causing this issue and how can I tell Deno to ignore those unsupported platforms while compiling?
No description
1 Reply
Deno AI Helper
Deno AI Helper•15mo ago
Based on the documentation, Deno's deno compile command allows you to compile your Deno projects into standalone executables. However, there are some limitations and not all features are supported. The error message you're seeing suggests that Deno is trying to read a symlink to a file that doesn't exist. This could be due to a number of reasons, but it's important to note that deno compile does not currently support all npm packages. This is mentioned in the documentation for Deno 1.34, where it states that deno compile now supports npm packages, but it's still a work in progress and there might be scenarios where something doesn't work. As for the --target flag, the documentation states that Deno currently supports compiling to Windows x64, macOS x64, macOS ARM, and Linux x64. However, the aarch64-apple-darwin builds are not supported in the canary releases yet, as mentioned in the Deno 1.6 release notes. If you're trying to compile a project that uses npm packages, you might run into issues. If this is the case, I would recommend reporting the problem to the Deno issue tracker, as the team is actively working on improving compatibility with npm. As a workaround, you might want to try removing or replacing the problematic npm packages, or consider using a different method to distribute your Deno project. Please note that this advice is not explicitly stated in the documentation, but is a general suggestion based on the information provided. 🦕

Did you find this page helpful?