Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Fred Young](https://secure.gravatar.com/avatar/cebea07578a77b1ffb60c451c3769ee9?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Fred Young
15,523 PointsSyntaxError: Unexpected token import
I encountered the following error while trying to run tests. I am using node v8.16.2, mocha v8.0.1, and chai v4.2.0.
treehouse:~/workspace$ npm test
> workspace@1.0.0 test /home/treehouse/workspace
> mocha
/home/treehouse/workspace/node_modules/mocha/lib/esm-utils.js:6
return import(url.pathToFileURL(file));
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/treehouse/workspace/node_modules/mocha/lib/cli/run-helpers.js:18:27)
Alessandra De Lucas
715 PointsAlessandra De Lucas
715 PointsGetting the same error.