FredericHeem / redux-act-async

Reduce boilerplate for redux async actions and reducers
Apache License 2.0
125 stars 22 forks source link

Don't require babel-cli #21

Closed tylercollier closed 8 years ago

tylercollier commented 8 years ago

When I try to install redux-act-async, I get:

$ nis redux-act redux-act-async

> redux-act-async@0.15.0 postinstall /home/tylercollier/repos/my-project/node_modules/redux-act-async
> npm run build

> redux-act-async@0.15.0 build /home/tylercollier/repos/my-project/node_modules/redux-act-async
> babel src --out-dir lib

sh: 1: babel: not found

npm ERR! Linux 3.19.0-66-generic
npm ERR! argv "/home/tylercollier/.nodenv/versions/6.3.1/bin/node" "/home/tylercollier/.nodenv/versions/6.3.1/bin/npm" "run" "build"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! redux-act-async@0.15.0 build: `babel src --out-dir lib`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the redux-act-async@0.15.0 build script 'babel src --out-dir lib'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the redux-act-async package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     babel src --out-dir lib

It's trying to run babel, from the babel-cli package, which I don't have on my production server. The cheater fix is for me to install babel-cli. But I think you should remove the postinstall script, since it seems like it's for dev only? When I look at the package of redux-act-async that's on npm, it already has a lib directory with the pre-built/babelfied files there anyway. Or perhaps you can use a prepublish script instead, like is suggested here:

{ 
  scripts: {
    "prepublish": "npm run build"
  }
}
FredericHeem commented 8 years ago

Thanks for the report, I should dig into this issue. In the mean time, add a .babelrc to your project as a workaround.

a-r-d commented 8 years ago

@FredericHeem just wanted to leave a note here in case it helps anyone: my build process creates a docker container and the postinstall babel-cli command was failing. The solution was to do as suggested and copy in .babelrc to my docker container in my Dockerfile (as well as add babel-cli to my dev-dependencies).

stevenla commented 8 years ago

there's no big reason to have the postinstall in addition to the prepublish

FredericHeem commented 8 years ago

Please try the new version 0.16.0 which removes the postinstall npm script. Let me know if it works for you. Thanks a lot everyone for the reports.