Sample script from Getting Started fails with Unexpected token import
See original GitHub issueThe sample script in the Getting Started section of the readme is failing with Unexpected token import
error. It seems the reason is that node 8 didn’t have import. OS is Ubuntu 20.04.
> node -v
v8.11.4
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
Issue Analytics
- State:
- Created 2 years ago
- Comments:7
Top Results From Across the Web
Node.js - SyntaxError: Unexpected token import - Stack Overflow
mjs file cannot import a file that uses require or module.exports . This was a huge problem, whereas esm allows you to mix...
Read more >JavaScript ES6 - How to fix Unexpected token import - YouTube
This video is a short explanation on how to fix the syntax error : " Unexpected Token Import "Hint: type="module"
Read more >Can't get simple script to run due to SyntaxError: Unexpected ...
Following the webpack documentation on the subject seems to give a Unexpected token import error. See webpack/webpack#5053 for more info. 1
Read more >Unexpected Token Export: A Comprehensive Guide
The “unexpected token export” error occurs because the module is not compatible with the program. There are various reasons this happens. Fix it...
Read more >How I Fixed The Unexpected Token Error In Jest
I have a CRA TS app and was getting import error for axios while testing. I updated the test script to react-scripts test...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue here:
That’s what the readme says: use version 8.11!
If I switch to the latest version of node/npm then I get an error installing the library. What version should we use?
Please use the latest version of Node and the SDK. If that doesn’t work try installing with yarn.
Please follow this issue for the latest updates on the npm install: https://github.com/ProjectOpenSea/opensea-js/issues/471
I will close this out to avoid duplicates and confusion!