Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
296 views
in Technique[技术] by (71.8m points)

node.js - npm run build fails with error originated from the build code

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 {
question from:https://stackoverflow.com/questions/65901034/npm-run-build-fails-with-error-originated-from-the-build-code

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...