node.js - NPM 模块 : react-csv-downloader on install gives Babel not found error

标签 node.js reactjs npm-install babeljs

我想在我的项目中安装 react-csv-downloader 包。 当我执行 npm install react-csv-downloader --save 时出现此错误

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

我在我的项目中使用 gulp,这是我的 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"
  },

请帮我安装这个包。 谢谢。

最佳答案

它没有在文档中的任何地方提到,但你需要添加 babel-cli 作为你的开发依赖,它会起作用。

关于node.js - NPM 模块 : react-csv-downloader on install gives Babel not found error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40037050/

相关文章:

reactjs - React-navigation:检测新屏幕是否完全聚焦

npm - cleancss 命令不起作用

javascript - 错误 : Cannot find module 'xml2json'

node.js - Heroku Discord.js ffmpeg

node.js - "WebKitFormBoundary"使用nodejs解析POST时

javascript - Node.js 存储图像。在前端获取这些图像

node.js - NodeJS + Cluster + Socket.IO 如何正确创建游戏房间?

javascript - 将 React api 上下文与 React Router 一起使用

javascript - 元素仅在 Safari 10 中消失(9 没问题),当我更改任何 css 时显示

node.js - NPM 在 github 分支依赖上失败