ReactJS部署应用程序错误无法复制到剪贴板:命令失败:xsel --clipboard --input

问题描述 投票:0回答:2

我正在尝试在我的Ubuntu 16.04服务器中部署ReactJS应用程序,但是当我执行命令时:

serve -s build

这是我的package.json文件:

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "bootstrap": "^4.3.1",
    "history": "^4.9.0",
    "jquery": "^3.4.0",
    "moment": "^2.24.0",
    "popper.js": "^1.15.0",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-router-dom": "^5.0.0",
    "react-scripts": "2.1.8"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

我收到此错误:

ERROR: Cannot copy to clipboard: Command failed: xsel --clipboard --input
xsel: Can't open display: (null)
: Inappropriate ioctl for device

   ┌──────────────────────────────────────────────────┐
   │                                                  │
   │   Serving!                                       │
   │                                                  │
   │   - Local:            http://localhost:5000      │
   │   - On Your Network:  http://server_IP:5000   │
   │                                                  │
   └──────────────────────────────────────────────────┘

但该应用程序未加载,无法在端口5000访问。

我怎么能弄清楚这个?

javascript node.js reactjs ubuntu deployment
2个回答
0
投票
  • 这是剪贴板模块的东西,尝试从你的APP删除它与npm卸载“在package.json中找到剪贴板模块名称”然后尝试重建,看看会发生什么?
  • 如果问题仍然存在,请尝试删除node_modules并重新安装

0
投票

我通过将nginx服务器直接指向我的ReactJS项目的/build文件夹,特别是index.html文件,避免了这个问题。

通过这种方式,我没有问题中描述的问题,因为我不再使用serve -s build命令执行服务。

© www.soinside.com 2019 - 2024. All rights reserved.