vercel / pkg

Package your Node.js project into an executable
https://npmjs.com/pkg
MIT License
24.33k stars 1.02k forks source link

Node 18.15 as Error #1924

Closed CooperJiang closed 1 year ago

CooperJiang commented 1 year ago

What version of pkg are you using?

5.8.1

What version of Node.js are you using?

node 18.15.0

What operating system are you using?

macOS

What CPU architecture are you using?

Intel

What Node versions, OSs and CPU architectures are you building for?

node18-mac-x64

Describe the Bug

Node.js v18.5.0 /snapshot/chatgpt-cooper/node_modules/.pnpm/registry.npmmirror.com+axios@1.3.4/node_modules/axios/lib/helpers/speedometer.js:55 export default speedometer; ^^^^^^

SyntaxError: Unexpected token 'export' at new Script (node:vm:102:7) at Socket. ([eval]:18:19) at Socket.emit (node:events:537:28) at addChunk (node:internal/streams/readable:324:12) at readableAddChunk (node:internal/streams/readable:297:9) at Readable.push (node:internal/streams/readable:234:10) at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

image

Expected Behavior

I used to package my Nestjs project, and my node version is 18.15.0. This error occurs: Unexpected token 'export'

To Reproduce

image

HenryOoO commented 1 year ago

+1

baparham commented 1 year ago

I'm pretty sure this relates to using ESM instead of commonjs. From what I remember, pkg doesn't support ecmascript, but I don't have the time to verify that claim, so it's just an idea for you to pursue to see if using commonjs instead works for you

baparham commented 1 year ago

found the reference in the pinned issue: https://github.com/vercel/pkg/issues/1291

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

github-actions[bot] commented 1 year ago

This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.