Git Product home page Git Product logo

Comments (8)

gagern avatar gagern commented on May 26, 2024

Just for the record: I consider this postinstall script (which according to e001097 helps “installing from GitHub”) to be a dirty hack to work around npm/npm#3055. But I can see the motivation to work around that for now. Just want to keep in mind that there may come a time when this script can be removed, since prepublish will do all that's required.

from expect.

mjackson avatar mjackson commented on May 26, 2024

@gagern npm's prepublish doesn't do what it says it does, so we use postinstall instead. It's just there to create the lib directory in case someone installs directly from GitHub (e.g. using npm install mjackson/expect). npm/npm#3055 will further expand upon the meaning of "prepublish" which makes me even more wary of using it. It's fixing stuff that's broken with more brokenness.

I'd be happy to consider a PR using $NODE instead of node provided we can find someone with a Windows machine to test it out.

from expect.

phated avatar phated commented on May 26, 2024

I think it is worth noting that if someone is using the nodejs binary on Ubuntu or Debian, they should probably get an error since (last I checked) the version of node those OSes shipped was 0.6 😢

from expect.

gagern avatar gagern commented on May 26, 2024

@phated: There are more recent versions of Node on the way, most notably Node 4 in testing:

  • jessie: 0.10.29~dfsg-2
  • stretch: 4.2.6~dfsg-1
  • precise: 0.6.12~dfsg1-1ubuntu1
  • trusty, vivid and wily: 0.10.25~dfsg2-2ubuntu1
  • xenial: 4.2.6~dfsg-1ubuntu1

from expect.

rstacruz avatar rstacruz commented on May 26, 2024

I think it is worth noting that if someone is using the nodejs binary on Ubuntu or Debian

even modern versions of node have their binaries set to nodejs. the workaround here is to use the node-legacy package (which despite its name, actually packages modern versions, only with its binary named as node)

from expect.

rstacruz avatar rstacruz commented on May 26, 2024

npm's prepublish doesn't do what it says it does, so we use postinstall instead.

Btw, in-publish exists as a workaround to this :)

from expect.

rstacruz avatar rstacruz commented on May 26, 2024

@mjackson,

It's just there to create the lib directory in case someone installs directly from GitHub (e.g. using npm install mjackson/expect).

To be fair, the workaround doesn't actually work when doing this:

npm install mjackson/expect
...
npm ERR! [email protected] build: `babel ./modules -d lib --stage 0 --loose all --ignore '__tests__'`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] build script 'babel ./modules -d lib --stage 0 --loose all --ignore '__tests__''.
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 expect package,

IMHO, it's still better to use a prepublish hook.

from expect.

mjackson avatar mjackson commented on May 26, 2024

Btw, in-publish exists as a workaround to this

I've tried using in-publish before but AFAICT it gives Windows users problems because there is no || operator in CMD.exe, only &&, which makes it impossible to restrict code to only running when you are not actually running as a result of npm publish (i.e. in an npm install).

the workaround doesn't actually work when doing this

Seems there's a bug.

from expect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.