Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Install Dredd without having Coffee globally installed #629

Closed
alikh31 opened this issue Sep 20, 2016 · 6 comments · Fixed by #632
Closed

Install Dredd without having Coffee globally installed #629

alikh31 opened this issue Sep 20, 2016 · 6 comments · Fixed by #632

Comments

@alikh31
Copy link

alikh31 commented Sep 20, 2016

Hey guys,

Is there anyway you can modify the package to run without having coffee-script globally installed, coffee-script turned to a hidden dependencies for the package.

when I try to install the package as I get the error:

> [email protected] postinstall /opt/bitnami/apps/jenkins/jenkins_home/workspace/device-model-api/alikh%2Fdredd/node_modules/dredd
> coffee scripts/print-installation-guidelines.coffee

sh: 1: coffee: not found
npm ERR! Linux 3.13.0-85-generic
npm ERR! argv "/home/tomcat/.nvm/versions/node/v4.4.4/bin/node" "/home/tomcat/.nvm/versions/node/v4.4.4/bin/npm" "install"
npm ERR! node v4.4.4
npm ERR! npm  v2.15.1
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! [email protected] postinstall: `coffee scripts/print-installation-guidelines.coffee`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script 'coffee scripts/print-installation-guidelines.coffee'.
npm ERR! This is most likely a problem with the dredd package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     coffee scripts/print-installation-guidelines.coffee
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs dredd
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls dredd
npm ERR! There is likely additional logging output above.

postinstall doesn't seems to do much stuff, maybe using require('coffee-script/register') would solve the issue if you insist using coffee-script in all stand alone scripts.

@honzajavorek
Copy link
Contributor

@alikh31 Hi, Dredd should not require global CoffeeScript to be installed. At the time of postinstall local coffee-script package should be already available in the node_modules. The package.json scripts should look for binaries in the node_modules/.bin folder by default, so when given "my-script": "coffee ...",, then npm run my-script should evaluate coffee as node_modules/.bin/coffee.

I see you have npm v2.15.1, not sure whether it makes any difference. I just tried it out with npm 3.8.6 and it works.

@alikh31
Copy link
Author

alikh31 commented Sep 20, 2016

@honzajavorek well that's my thought as well, but I am not quite sure why this issue is popping up.

In my machine or my test docker container I can't reproduce it, but somehow it happens in that machine which might be due to the tricky things in nvm.

the dummy way that fixes it is having node coffee rather than coffee in package.json

@honzajavorek
Copy link
Contributor

honzajavorek commented Sep 22, 2016

@alikh31 I'm completely okay with rewriting scripts/print-installation-guidelines.coffee to ES5 JavaScript if it makes portability better. Would you be willing to contribute it?

The multiline string could be probably easily implemented as

[
  'line',
  'line',
  'line',
  ...
].join('\n')

and the rest would be basically just adding semicolons 😄

@alikh31
Copy link
Author

alikh31 commented Sep 22, 2016

@honzajavorek right there isn't much effort, have you guys considered writing the whole thing in ES6 maybe? the difference is not that much after all.

@honzajavorek
Copy link
Contributor

@alikh31 Dredd's older than ES6/ES2015 :) It isn't that similar either and porting the whole codebase to ES2015 would mean a lot of time and effort while not a single new feature or bugfix would be there for Dredd users. That's something we can't afford with current resources. See coffeescript6/discuss#32 (comment) for details.

Thanks for the PR, btw!

@alikh31
Copy link
Author

alikh31 commented Sep 22, 2016

sure, that's understandable. no problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants