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

Syntax error: Unexpected token 'export' #133

Closed
deaglancrew opened this issue Jul 18, 2024 · 7 comments · Fixed by #135
Closed

Syntax error: Unexpected token 'export' #133

deaglancrew opened this issue Jul 18, 2024 · 7 comments · Fixed by #135
Labels

Comments

@deaglancrew
Copy link

deaglancrew commented Jul 18, 2024

We're getting some issues in our CI using prism. Looks like it's related to this release ( https://github.com/stoplightio/json/releases/tag/v3.21.1) ?

Context

It's preventing us from running integration tests atm.

Current Behavior

On running prism we see:

/home/circleci/.local/lib/node_modules/@stoplight/prism-cli/node_modules/@stoplight/json/index.js:1
export * from './bundle';
^^^^^^

SyntaxError: Unexpected token 'export'
    at internalCompileFunction (node:internal/vm:128:18)
    at wrapSafe (node:internal/modules/cjs/loader:1280:20)
    at Module._compile (node:internal/modules/cjs/loader:1332:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/circleci/.local/lib/node_modules/@stoplight/prism-cli/node_modules/@stoplight/prism-http/dist/utils/runtimeExpression.js:8:16)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)

Node.js v20.12.1

Expected Behavior

It should run :-)

Steps to Reproduce

We're using the cimg/python:3.12.3-node docker image, installing prism with:

npm install --prefix=$HOME/.local -g @stoplight/prism-cli

The error raises when we run prism mock.

## Workarounds

You can manually pin the json version to a working version on install as a temporary workaround:

npm install --prefix=$HOME/.local -g @stoplight/json@3.21.0 @stoplight/prism-cli

Environment

  • Version used:
  • Environment name and version (e.g. Chrome 39, node.js 5.4):
  • Operating System and version (desktop or mobile):
  • Link to your environment/workspace/project:
@silverwind
Copy link

Seeing the same. Imho modules like spectral-cli and prism-cli should lock their dependencies to exact version to prevent such breakage in the future.

@dpereverzev
Copy link

+1

@deaglancrew
Copy link
Author

For anyone here, you can manually pin this dependency when you install, which will get this working, but it's not a very permanent fix.
e.g.
npm install --prefix=$HOME/.local -g @stoplight/json@3.21.0 @stoplight/prism-cli
in your CI.

@SB-rohitdesai @prafullaAtSB can this be rolled back or fixed easily #132 ?

@PratMoha
Copy link

PratMoha commented Jul 18, 2024

This change is also impacting @stoplight/spectral-cli@v6.11.0 . Seems spectral is referring it to latest @stoplight/json version causing to fail with the above mentioned error.

@simonbs
Copy link

simonbs commented Jul 18, 2024

We're seeing the same when installing the spectral-cli like this:

npm install -g @stoplight/spectral-cli

@mnaumanali94
Copy link

We are currently working on fixing this!

@stoplight-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 3.21.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants