【发布时间】:2020-03-28 12:12:57
【问题描述】:
我对此有点陌生,已经创建了 react 前端和 Node 后端应用程序并尝试在 docker 中部署,但它抛出了以下错误。有人可以帮助我为什么要引用 python,以及为什么 couchbase 安装有问题吗?
Package.json 文件有
{
"name": "XPress",
"version": "0.1.0",
"private": true,
"dependencies": {
"antd": "^3.10.8",
"axios": "^0.18.1",
"body-parser": "^1.19.0",
"cors": "2.8.5",
"couchbase": "^2.6.11",
"dva": "^2.4.1",
"dva-loading": "^2.0.6",
"express": "^4.17.1",
"pg": "^7.18.2",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "2.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app",
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": true
}
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
错误
TestUser-8681:Utility TestUser$ docker build . -t xpressimg
Sending build context to Docker daemon 434.4MB
Step 1/7 : FROM node:alpine
---> 483343d6c5f5
Step 2/7 : WORKDIR /xpress
---> Using cache
---> fc35b4f51420
Step 3/7 : COPY package*.json ./
---> Using cache
---> 5593b2fe0b05
Step 4/7 : RUN npm install
---> Running in f00b67e0b069
> couchbase@2.6.11 install /xpress/node_modules/couchbase
> prebuild-install || node-gyp rebuild
prebuild-install WARN install unable to get local issuer certificate
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47)
gyp ERR! stack at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:179:16)
gyp ERR! stack at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:271:16)
gyp ERR! stack at exithandler (child_process.js:310:5)
gyp ERR! stack at ChildProcess.errorhandler (child_process.js:322:5)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
gyp ERR! stack at onErrorNT (internal/child_process.js:467:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:84:21)
gyp ERR! System Linux 4.19.76-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 /xpress/node_modules/couchbase
gyp ERR! node -v v13.12.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/react-scripts/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! couchbase@2.6.11 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the couchbase@2.6.11 install 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! /root/.npm/_logs/2020-03-28T03_12_19_475Z-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 1
感谢您在这方面的支持
根据提供的建议,我看到以下错误 将构建上下文发送到 Docker 守护进程 434.4MB [警告]:在以下位置找到空续行: 运行 apk 添加 --update-cache python python-dev py-pip build-base WORKDIR /xpress [警告]:空的续行将成为未来版本中的错误。 第 1/7 步:从节点:高山 ---> 483343d6c5f5 第 2/7 步:运行 apk add --update-cache python python-dev py-pip build-base WORKDIR /xpress ---> 在 e587974d8218 中运行 获取http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz 获取http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz 错误:不可满足的约束: /xpress(缺失): 要求:世界[/xpress] 工作目录(缺失): 要求:世界[WORKDIR] 命令 '/bin/sh -c apk add --update-cache python python-dev py-pip build-base WORKDIR /xpress' 返回一个非零代码:2
【问题讨论】:
标签: node.js reactjs docker couchbase