Skip to content

fix: add shebang to index.ts for node execution#246

Merged
Boshen merged 1 commit intooxc-project:mainfrom
situ2001:situ/0831-shebang
Aug 31, 2025
Merged

fix: add shebang to index.ts for node execution#246
Boshen merged 1 commit intooxc-project:mainfrom
situ2001:situ/0831-shebang

Conversation

@situ2001
Copy link
Contributor

When using pnpm, everything works well. But when it comes to npm, error occured:

➜  examples npm i @oxc-node/cli 

added 26 packages, and audited 27 packages in 505ms

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
➜  examples npm exec oxnode    
import-im6.q16: unable to open X server `' @ error/import.c/ImportImageCommand/346.
import-im6.q16: unable to open X server `' @ error/import.c/ImportImageCommand/346.
import-im6.q16: unable to open X server `' @ error/import.c/ImportImageCommand/346.
import-im6.q16: unable to open X server `' @ error/import.c/ImportImageCommand/346.
/home/situ/Codes/examples/node_modules/.bin/oxnode: 6: //#region: not found
/home/situ/Codes/examples/node_modules/.bin/oxnode: 7: var: not found
/home/situ/Codes/examples/node_modules/.bin/oxnode: 8: Syntax error: word unexpected (expecting ")")

After adding shebang, the CLI works with npm exec oxnode

@situ2001
Copy link
Contributor Author

Here is the worked CLI output.

➜  examples sed -i '1i\#!/usr/bin/env node' ./node_modules/@oxc-node/cli/dist/index.js
➜  examples ls node_modules/.bin -al                                                  
total 8
drwxrwxr-x 2 situ situ 4096  8月 31 14:34 .
drwxrwxr-x 8 situ situ 4096  8月 31 14:34 ..
lrwxrwxrwx 1 situ situ   30  8月 31 14:34 oxnode -> ../@oxc-node/cli/dist/index.js
➜  examples npm exec oxnode                                                           
Welcome to Node.js v22.14.0.
Type ".help" for more information.
> 

@Boshen Boshen merged commit db5efd6 into oxc-project:main Aug 31, 2025
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants