Search code examples
node.jsamazon-web-servicessyntaxnvm

syntax error near unexpected token `'../lib/cli.js''


The file in question:

#!/root/.nvm/versions/node/v17.5.0/bin/node
require('../lib/cli.js')(process)
  • Node -v 17.5.0

    NPM -v 8.4.1

    PM2 -v 5.1.2

    Next.js v11.1.3

Trying to run in an Amazon EC2 instance on the default Linux AMI. Any thoughts?


Solution

  • No idea what fixed it. But the ancient artform of nuke everything and start from scratch fixed it.

    EDIT: Specifically, I had some legacy flag --interpreter bash that I appended to the pm2 run script (probably referencing some 2016 stack overflow answer). Removing this fixed all issues I had with PM2