npm postinstall fails when the package is a (git) dependency.

249 views
Skip to first unread message

Tom

unread,
Mar 5, 2014, 4:18:27 AM3/5/14
to nod...@googlegroups.com
Hi.

I have RepoA and RepoB which both contain a package.json.

RepoA is my 'library' that I want to use in a set of other projects.

All my code is written using CoffeeScript, and I am using Gulp to compile this from a src/ to a build/ directory.

RepoA's package.json contains:

...
"main": "build/index",
...
"dependencies": {
  ...
  "gulp": "*",
  ...
},
...
"scripts": {
  "postinstall": "./node_modules/.bin/gulp --require coffee-script/register"
},
...

When I run npm install from RepoA, it installs all npm packages including gulp then runs the postinstall command, generating my build files and making the main entry work.

When I run npm install from RepoB, which has listed RepoA as one of its dependencies using git+https:// to my gitlab instance, it will fail claiming gulp is not installed ("sh: gulp: command not found").
When I run npm install from RepoB again, gulp is already installed and the postinstall run works.

So it works the second try.

What am I doing wrong here?

gr,

Tom

Tom

unread,
Mar 5, 2014, 4:25:11 AM3/5/14
to nod...@googlegroups.com
By advice of IRC I have removed the './node_modules/.bin' from the postinstall but that gives me the same result.

Tom Wieland

unread,
Mar 5, 2014, 4:45:04 AM3/5/14
to nod...@googlegroups.com
I have now created a RepoA/index.js containing

require('coffee-script/register');
module.exports = require('./src/index.coffee');

which works but is not the solution I was looking for :S

Alex Kocharin

unread,
Mar 5, 2014, 10:15:33 PM3/5/14
to nod...@googlegroups.com
 
I think it should be "prepublish", not "postinstall".
 
 
05.03.2014, 13:18, "Tom" <tom.w...@gmail.com>:
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages