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

SyntaxError: Cannot use import statement outside a module in 1-consume-promise.ts #2

Open
terence4444 opened this issue Oct 9, 2021 · 1 comment

Comments

@terence4444
Copy link

Hello,

Thanks for the informative video and this demo.

Unfortunately there is an error: SyntaxError: Cannot use import statement outside a module when I tried executing 1-consume-promise.ts with command line node .\1-consume-promise.ts

As a beginner I am not able to figure out what's the root cause.
It looks like the import style is not supported by default...
I replaced the import line to require('node-fetch'); as those in other code samples and it worked.

My environment:

  • Windows 10 Version 10.0.19043.1237
  • Node v14.18.0 LTS
  • Code executed in VSCode

Thanks & best regards,

@terence4444
Copy link
Author

After looking around, I realize it might be connected to outdated version of @types/node
But I am not able to find a corresponding version for Node v14.18.0 LTS :(

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

No branches or pull requests

1 participant