sorenlouv / backport

A simple CLI tool that automates the process of backporting commits on a GitHub repo
https://github.com/sqren/backport/blob/main/docs/config-file-options.md
Apache License 2.0
241 stars 57 forks source link

Unexpected token . #450

Open ct2034 opened 1 year ago

ct2034 commented 1 year ago

I installed the tool with sudo npm install -g --unsafe-perm backport. When I run backport, nothing happens. When I run npx backport i get:

Unexpected token .

I created both config files according to https://github.com/sqren/backport/blob/main/docs/config-file-options.md

sorenlouv commented 1 year ago

Hey!

It could be related to you running with sudo. I'll try to see if I can reproduce.

gigerdo commented 1 year ago

I just had the same problem. It was caused by accidentally using an old node version (12). Using node 16 fixed the problem.

sorenlouv commented 1 year ago

Ahh, interesting. Thanks for chiming in @gigerdo . @ct2034 Is that perhaps the same problem you are running into?

li-boxuan commented 1 year ago

I was using node 8 and saw the same problem. Using node 16 fixed the problem.

sorenlouv commented 1 year ago

@li-boxuan Thanks for chiming in. I might be able to catch this and warn the user with something like:

import semver from 'semver';
import { engines } from './package';

const version = engines.node;
if (!semver.satisfies(process.version, version)) {
  console.log(`Required node version ${version} not satisfied with current version ${process.version}.`);
  process.exit(1);
}