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

Cannot use import statement outside a module #259

Open
tridungle opened this issue Mar 23, 2021 · 8 comments
Open

Cannot use import statement outside a module #259

tridungle opened this issue Mar 23, 2021 · 8 comments
Labels
pinned Issues that will not be automatically closed

Comments

@tridungle
Copy link

Describe the bug
[email protected]

To Reproduce
Steps to reproduce the behavior:

  1. install
  2. config swagger with swagger-jsdoc
  3. start the server
  4. See error

Screenshots

/node-boilerplate//node_modules/swagger-jsdoc/index.js:1
import { prepare, extract, organize, finalize } from './src/specification.js';
^^^^^^
SyntaxError: Cannot use import statement outside a module
    at Module._compile (internal/modules/cjs/loader.js:895:18)
    at Module._compile (/node-boilerplate/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Object.newLoader [as .js] (/node-boilerplate/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
@cesco69
Copy link

cesco69 commented Mar 29, 2021

same for me...

@Leehee1on
Copy link

same issue.

@datnguyen199
Copy link

yes, i also got this error, does anyone know how to fix?

@akshay-nm
Copy link

Why would you convert cjs module to es when it is probably designed to be used with node where majority of stuff is cjs?

@rahulmathews
Copy link

I also faced the same Issue. I solved this issue temporarily by downgrading the version from v7 to v6 using npm i [email protected]

@datnguyen199
Copy link

@rahulmathews thank you, it also solved this for me

@HappyZombies
Copy link

plz fix

@stale
Copy link

stale bot commented Jun 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 26, 2021
@daniloab daniloab added the pinned Issues that will not be automatically closed label Jun 28, 2021
@stale stale bot removed the wontfix label Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pinned Issues that will not be automatically closed
Projects
None yet
Development

No branches or pull requests

8 participants