ReactJS deploy app error Cannot copy to clipboard: Command failed: xsel --clipboard --input

10,703

Solution 1

I had the same issue and I solved it by adding "-n" option to serve.

"-n, --no-clipboard Do not copy the local address to the clipboard"

Solution 2

I avoided the problem by pointing the nginx server directly to the /build folder of my ReactJS project and specifically to the index.html file.

In this way I don't have the problem described in the question, because I don't execute anymore a service with serve -s build command.

Share:
10,703
Dave
Author by

Dave

SUMMARY ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ I’m a Full Stack Software Engineer who has been doing software development. I work simultaneously in the development of web applications and server-side features, such as building powerful and efficient APIs. TECHNOLOGIES ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ Here is a quick list of some of the technologies I've worked on in the recent past. JavaScript: Express, Node.js, Sails.js, VueJS, ReactJS, React Native, Redux, KoaJS .NET: C#, DevExpress Tools Databases: MongoDB, MySQL, Oracle, PostgreSQL, Redis, MS-SQL Server Deployment: AWS, Heroku, Vagrant Servers: Apache, Nginx OS: Linux, OS X, Windows Development Methods: Agile, SCRUM Other: PHP, HTML5, CSS, Python ROLES ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ Here are a few different ways I can help. ♨ As an Architect You need help architecting a new product from scratch, or improving an existing one to make it more current, performant, scalable or maintainable. ♨ As a Developer You need help leading a development team, or are looking for an independent contributor to help out with development. ♨ As a Problem Solver You have a varying list of ever changing software engineering needs and need someone who can do a bit of everything!

Updated on June 05, 2022

Comments

  • Dave
    Dave almost 2 years

    I'm trying to deploy a ReactJS app in my Ubuntu 16.04 server but when I execute the command:

    serve -s build

    This is my package.json file:

    {
      "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"
      ]
    }
    

    I get this error:

    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   │
       │                                                  │
       └──────────────────────────────────────────────────┘
    

    But the app is not loaded and is not accessible at the port 5000.

    How can I figured out this?

  • Dave
    Dave about 5 years
    Unfortunatly I don't have any clipboard module in my package.json file... I updated my question with my package.json file.
  • Haseeb Ahmad
    Haseeb Ahmad about 3 years
    Can you please tell me how to do this?