NPM MOdule: react-csv-downloader on install gives

2019-07-04 03:26发布

问题:

I am looking to install react-csv-downloader package in my project. when i do npm install react-csv-downloader --save i get this error

react-csv-downloader@0.1.4 postinstall /home/tops/Desktop/demo_projects/mern_stack/node_modules/react-csv-downloader
> npm run build


> react-csv-downloader@0.1.4 build /home/tops/Desktop/demo_projects/mern_stack/node_modules/react-csv-downloader
> babel src -d dist

sh: 1: babel: not found

npm ERR! react-csv-downloader@0.1.4 build: `babel src -d dist`
npm ERR! Exit status 127
npm ERR! 
npm ERR! Failed at the react-csv-downloader@0.1.4 build script.
npm ERR! This is most likely a problem with the react-csv-downloader package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     babel src -d dist
npm ERR! You can get their info via:
npm ERR!     npm owner ls react-csv-downloader
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! cwd /home/tops/Desktop/demo_projects/mern_stack/node_modules/react-csv-downloader
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/tops/Desktop/demo_projects/mern_stack/node_modules/react-csv-downloader/npm-debug.log
npm ERR! not ok code 0
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! react-csv-downloader@0.1.4 postinstall: `npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the react-csv-downloader@0.1.4 postinstall script.
npm ERR! This is most likely a problem with the react-csv-downloader package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run build
npm ERR! You can get their info via:
npm ERR!     npm owner ls react-csv-downloader
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 4.2.0-42-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "react-csv-downloader" "--save"
npm ERR! cwd /home/tops/Desktop/demo_projects/mern_stack
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/tops/Desktop/demo_projects/mern_stack/npm-debug.log
npm ERR! not ok code 0

I am using gulp in my project and here is my package.json

"dependencies": {
    "babel-preset-react": "^6.16.0",
    "babelify": "^7.3.0",
    "bluebird": "^3.4.6",
    "body-parser": "^1.15.2",
    "browserify": "^13.1.0",
    "express": "^4.14.0",
    "fixed-data-table": "^0.6.3",
    "fs": "0.0.1-security",
    "gulp": "^3.9.1",
    "history": "^4.3.0",
    "jquery": "^3.1.1",
    "json2xls": "^0.1.2",
    "mongodb": "^2.2.10",
    "multer": "^1.2.0",
    "react": "^15.3.2",
    "react-bootstrap": "^0.30.5",
    "react-bootstrap-table": "^2.5.5",
    "react-dom": "^15.3.2",
    "react-router": "^2.8.1",
    "superagent": "^2.3.0",
    "superagent-bluebird-promise": "^4.1.0",
    "superagent-promise-headers": "^1.2.0",
    "vinyl-source-stream": "^1.1.0",
    "watchify": "^3.7.0"
  },

Please help me to install this package. Thanks.

回答1:

It's not mentioned anywhere in the docs, but you will need to add babel-cli as your dev dependency and it will work.