Sign in
Log inSign up

SyntaxError: Unexpected token import

Anuj Sharma's photo
Anuj Sharma
·Mar 20, 2017

Hello,

I am getting this error

When I was run it via simple command "pm2 start test.js"

import express from 'express';
^^^^^^
SyntaxError: Unexpected token import

But if I run it via grunt. Its working fine.

I want to run it via PM2.

I search over google and try to find out reason but I am not satisfied.

Lots of thanks in Advance.

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2025 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct