0

I'm building my app by running npm run build and it errors out with this output:

/home/markalexa/blog/client/node_modules/react-dev-utils/node_modules/globby/index.js:47
            ...taskOptions,
            ^^^

SyntaxError: Unexpected token ...

it points to this code block in index.js within the node_modules directory:

const generateGlobTasks = (patterns, taskOptions) => {
    patterns = arrayUnion([].concat(patterns));
    assertPatternsInput(patterns);
    checkCwdOption(taskOptions);

    const globTasks = [];

    taskOptions = {
        ...taskOptions,    // <--
        ignore: [],
        expandDirectories: true

    };

The build has problem with the spread operator for some reason. Can you give me any pointers to how to fix this ? I'm not really a npm developer.

node version: 6.11.4
npm version: 6.14.11

Thank you.

Edit:

After updating node to 8.6 which bumped up version of V8 as well I'm getting this after running npm run build:

/home/markalexa/blog/client/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
      } catch {
              ^
SyntaxError: Unexpected token {
wood
  • 75
  • 1
  • 7
  • Update your version of node.js to a newer version (`>=8.6.0`) because version `6.11.4` [does not support object spread properties](https://node.green/#ES2018-features-object-rest-spread-properties). – RobC Jan 26 '21 at 12:32

2 Answers2

0

Upgrading Node to 10.19 solved the problem. Looks like if you're not using one of the most recent releases javascript code will break.

wood
  • 75
  • 1
  • 7
0

I was using node v6 for working on another project. Using nvm, I switched to node v14 and the issue was resolved.

ouflak
  • 2,458
  • 10
  • 44
  • 49