问题
Update
Fixed it by running
rm -rf node_modules && rm -rf yarn.lock && yarn && docker-compose -f docker-compose.dev.yml up --build
I'm having trouble running my app with Docker.
Fist, I build the image,
// build image
$ docker-compose -f docker-compose.dev.yml up
docker-compose.dev.yml
:
version: '3.8'
services:
print:
stdin_open: true
build:
context: .
dockerfile: Dockerfile.dev
ports:
- '3000:3000'
volumes:
- '.:/app'
- '/app/node_modules'
Dockerfile.dev
:
FROM node:alpine
WORKDIR /app
COPY package.json /app
RUN yarn install
COPY . .
CMD ["yarn", "start"]
package.json
:
{
"name": "pprb-frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.56",
"@types/node": "^12.0.0",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@types/react-redux": "^7.1.11",
"chart.js": "^2.9.4",
"formik": "^2.2.5",
"history": "^5.0.0",
"react": "^17.0.1",
"react-chartjs-2": "^2.11.1",
"react-dom": "^17.0.1",
"react-redux": "^7.2.2",
"react-redux-toastr": "^7.6.5",
"react-router-dom": "^6.0.0-beta.0",
"react-scripts": "4.0.0",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-thunk": "^2.3.0",
"typescript": "^4.0.3"
},
"devDependencies": {
"@types/react-redux-toastr": "^7.6.0",
"@types/react-router": "^5.1.8",
"@types/react-router-dom": "^5.1.6",
"@types/styled-components": "^5.1.4",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"reload": "rm -rf node_modules && yarn",
"reload:start": "yarn reload && yarn start"
},
}
What's going on here? I took a look here, but that doesn't resolve my issue.
Docker image, if necessary is: docker pull mkhoussid/cra_img:secondtry
. Running it throws the error,
(0 , _schemaUtils.default) is not a function
Edit
I've run the below:
$ docker container prune
$ docker image prune
$ docker rmi $(sudo docker images -aq) --force
$ docker-compose -f docker-compose.dev.yml up --build
But that didn't help.
来源:https://stackoverflow.com/questions/64897545/getting-error-0-schemautils-default-is-not-a-function-when-running-cra-on-d