无法在React.js中使用NPM安装react-export-excel

时间:2019-06-07 04:49:20

标签: node.js reactjs npm npm-install

我正在运行:npm install react-export-excel --save

,我收到以下错误消息:

enter image description here

我在安装jspdf时收到了相同的错误(我可以成功安装某些其他库,例如文件保护程序,我可以安装较低版本的jspdf,即1.4)。

这是我的package.json文件:

       {
      "name": "insurance_automation",
      "version": "0.1.0",
      "private": true,
      "dependencies": {
        "axios": "^0.18.0",
        "babel-polyfill": "^6.26.0",
        "bcryptjs": "^2.4.3",
        "body-parser": "^1.19.0",
        "config": "^3.1.0",
        "cors": "^2.8.5",
        "express": "^4.17.1",
        "file-saver": "^2.0.2",
        "js-xlsx": "^0.8.22",
        "jsonwebtoken": "^8.5.1",
        "multer": "^1.4.1",
        "mysql2": "^1.6.5",
        "node": "^11.15.0",
        "nodemailer": "^6.2.1",
        "react": "^16.8.6",
        "react-dom": "^16.8.6",
        "react-pdf": "^4.0.5",
        "react-router-dom": "^5.0.0",
        "react-scripts": "3.0.1",
        "sequelize": "^5.8.6",
        "universal-cookie": "^4.0.0",
        "xlsx": "^0.14.3"
      },
      "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject",
        "server": "nodemon server",
        "dev": "concurrently \"npm run server\" \"npm start\" "
      },
      "eslintConfig": {
        "extends": "react-app"
      },
      "browserslist": {
        "production": [
          ">0.2%",
          "not dead",
          "not op_mini all"
        ],
        "development": [
          "last 1 chrome version",
          "last 1 firefox version",
          "last 1 safari version"
        ]
      },
      "devDependencies": {
        "concurrently": "^4.1.0",
        "nodemon": "^1.19.1"
      }
    }

我猜该节点的版本低于12,以便使用nodemailer发送邮件以支持使用TLS v1.0或更低版本的邮件服务器。

1 个答案:

答案 0 :(得分:0)

尝试这样安装

npm install react-export-excel@0.5.2 --save

确保您使用管理员帐户或在Linux中使用sudo

您也可以尝试此套餐 https://github.com/react-csv/react-csv