I have been trying to use circle ci with create react app, but I confronted this error.
#!/bin/bash -eo pipefail
CI=true npm run build
> react-scripts build
/home/circleci/project/node_modules/react-scripts/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
} catch {
^
SyntaxError: Unexpected token {
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._compile (module.js:613:28)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/circleci/.npm/_logs/2021-09-24T23_47_26_734Z-debug.log
Exited with code exit status 1
CircleCI received exit code 1
These are my simple setup.
# .circleci/config.yml
version: 2.1
jobs:
build:
docker:
- image: circleci/node:9.8
steps:
- checkout
- run: echo "npm installing"
- run: npm install
- run: CI=true npm run build
// package.json
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-redux": "^7.2.4",
"react-scripts": "^4.0.3"
Does anyone have any clue why this error comes up? Would this be about node version or something?...
I have changed the node image to the latest and it worked!!
- image: circleci/node:latest