在我尝试通过从3.0升级
至docker
客户端服务中的react scripts
来解决一些网络断开问题之前,我的客户机一切正常。13.3。0,使用npm安装
但后来它开始抱怨需要
css加载器
和style加载器
,我安装了它们。然后它不起作用,我将设置恢复到3.0。1
,卸载带有--save
标志的前两个软件包,以便将其从节点\u模块/
中删除。
现在,当我运行
docker-compose-fdocker-compose-dev.yml构建客户端
时,我得到以下错误,尽管客户端服务已经构建:
> fsevents@1.2.11 install /usr/src/app/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@11.12.0 | linux | x64
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:158:21)
gyp ERR! System Linux 4.9.184-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/app/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v11.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
> core-js@3.6.4 postinstall /usr/src/app/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> fsevents@1.2.11 install /usr/src/app/node_modules/jest-haste-map/node_modules/fsevents
> node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@11.12.0 | linux | x64
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:158:21)
gyp ERR! System Linux 4.9.184-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/app/node_modules/jest-haste-map/node_modules/fsevents
gyp ERR! node -v v11.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
这是我的docker-compose-dev.yml:
web:
build:
context: ./services/web
dockerfile: Dockerfile-dev
volumes:
- './services/web:/usr/src/app'
ports:
- 5001:5000
environment:
- FLASK_ENV=development
- APP_SETTINGS=brandio.config.DevelopmentConfig
- DATABASE_URL=postgres://postgres:postgres@web-db:5432/web_dev
- DATABASE_TEST_URL=postgres://postgres:postgres@web-db:5432/web_test
- SECRET_KEY=my_precious
depends_on:
- web-db
- redis
client:
build:
context: ./services/client
dockerfile: Dockerfile-dev
volumes:
- './services/client:/usr/src/app'
- '/usr/src/app/node_modules'
ports:
- 3000:3000
environment:
- NODE_ENV=development
- REACT_APP_WEB_SERVICE_URL=${REACT_APP_WEB_SERVICE_URL}
depends_on:
- web
这是我的客户Dockerfile:
# base image
FROM node:11.12.0-alpine
# set working directory
WORKDIR /usr/src/app
# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH
# install and cache app dependencies
COPY package.json /usr/src/app/package.json
COPY package-lock.json /usr/src/app/package-lock.json
RUN npm ci
RUN npm install react-scripts@3.3.0 -g --silent
# start app
CMD ["npm", "start"]
客户端所依赖的web服务Dockerfile。我已经尝试在env中安装
node gyp
,而python
肯定就在这里。无济于事:
FROM python:3.7-slim-buster
RUN apt-get update && apt-get -y dist-upgrade
RUN apt-get -y install node-gyp build-essential libssl-dev libffi-dev libblas3 libc6 liblapack3 gcc python3-dev
RUN apt install -y netcat
# set working directory
WORKDIR /usr/src/app
COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip3 install -r requirements.txt
# add entrypoint.sh
COPY ./entrypoint.sh /usr/src/app/entrypoint.sh
RUN chmod +x /usr/src/app/entrypoint.sh
# add app
COPY . /usr/src/app
# run server
CMD ["/usr/src/app/entrypoint.sh"]
包裹json:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.1",
"react": "^16.8.6",
"react-alert": "^5.5.0",
"react-dom": "^16.8.6",
"react-hot-loader": "^4.5.3",
"react-html-parser": "^2.0.2",
"react-player": "^1.13.0",
"react-router-dom": "^5.0.0",
"react-scripts": "^3.3.0",
"react-transition-group": "^2.9.0",
"spotify-web-api-js": "^1.2.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2"
}
}
现在它又回到了
3.3.0
,但是问题依然存在。
$npm list
显示了对等依赖的问题:
npm ERR! peer dep missing: @types/react@^15.0.0 || ^16.0.0, required by react-hot-loader@4.12.18
npm ERR! peer dep missing: typescript@^3.2.1, required by react-scripts@3.3.0
npm ERR! peer dep missing: node-sass@^4.0.0, required by sass-loader@8.0.0
npm ERR! peer dep missing: sass@^1.3.0, required by sass-loader@8.0.0
npm ERR! peer dep missing: fibers@>= 3.1.0, required by sass-loader@8.0.0
npm ERR! peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1
npm ERR! peer dep missing: typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta, required by tsutils@3.17.1
我不知道问题是否相关。
我还全局安装了
节点gyp
,经过测试,错误依然存在,然后再次卸载。
我该怎么解决这个问题?
将以下行添加到您的客户端Dockerfile:
RUN apk update && apk add python make g++
所以它应该是这样的:
# base image
FROM node:11.12.0-alpine
RUN apk update && apk add python make g++
# set working directory
WORKDIR /usr/src/app
# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH
# install and cache app dependencies
COPY package.json /usr/src/app/package.json
COPY package-lock.json /usr/src/app/package-lock.json
RUN npm ci
RUN npm install react-scripts@3.3.0 -g --silent
# start app
CMD ["npm", "start"]
npm and related build and dev tools Please feel free to create an issue or open a pull request if you need support or would like to contribute. Portable node, package managers and build tools Tagged I
问题内容: 简要阅读以上文章后,我发现getter和setter是糟糕的OO设计,应避免使用它们,因为它们与封装和数据隐藏相反。在这种情况下,创建对象时如何避免这种情况,以及如何将一个模型对象考虑在内。 如果需要使用吸气剂或吸气剂,还可以使用其他替代方法吗? 谢谢。 问题答案: 吸气或吸气器本身并不是很糟糕的OO设计。 不好的是编码实践,它会自动为每个单个成员包括一个getter和一个setter
问题内容: 我有一个在Docker容器中运行的应用程序。它需要公司私有NPM注册表(Sinopia)中的一些私有模块,访问这些模块需要用户身份验证。Dockerfile是。 我努力了: 1)创造在项目的根的.npmrc文件,这其实没有什么区别和NPM似乎使用ENV变量忽略它2) ,等等,但用户不登录。 本质上,我似乎无法在此过程中对用户进行身份验证。我希望有人可能已经遇到了这个问题(似乎是一个显而
问题内容: 嗨,我在安装react-dom模块时遇到问题。 我可以在Windows 10上安装其他模块,例如React Express模块。64位计算机 问题答案: 是是由反恶意软件引起的
问题内容: 在Python中,假设我有一些从Shape继承的类Circle。形状需要x和y坐标,此外,圆需要半径。我希望能够通过执行以下操作来初始化Circle, Circle继承自shape,因此我需要对使用命名参数,因为不同的类需要不同的构造函数。我可以手动设置x,y和r。 或者,我可以使用以下方式自动设置“圈子”的属性 这样做的好处是代码更少,并且我不需要维护样板。缺点是,Circle需要哪
问题内容: 尝试在Linux上没有SU权限的情况下安装/更新软件包时遇到错误。 解决问题的 简单 方法是execute ,但是我不确定这是否是一个好主意。 最好的方法是成为文件夹的所有者,正如我在StackOverflow的问题和博客文章中发现的那样。 我的问题是:为什么以SU身份运行不是一个好主意? 问题答案: 运行超级用户具有运行某些不可信代码作为超级用户的风险,其可以与你的整个系统潜在的混乱