Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm postinstall fails with multiple commands

Inside my composer.json, there's a postinstall hook setup like the following:

"scripts" : {
    "dist" :        "node dist; node_modules/.bin/doccoh src/package.js",
    "postinstall" : "node_modules/.bin/grunt setup || true; node_modules/.bin/bower install",
    "start" :       "node server.js"
}

Whenever I run it (on Win from Git/Gnu Bash CLI), I end with

command not found. either the command was written wrong or couldn't be found

Rough translation from German CLI error.

I tried splitting it into multiple ;/semicolon separated parts and first cd into that directory, but it simply ends up with the same error message. Replacing the whole postinstall command set with a simple ls does work. So I guess the problem might be the semicolon separation or a wrong usage of commands. But overall I got no idea what's wrong.

Note: I got grunt-cli version 0.1.9 and grunt version 0.4.1 installed globally.

like image 227
kaiser Avatar asked Sep 04 '13 18:09

kaiser


2 Answers

I'm a bit late to answer, but if you're on Windows, multiple commands on a single line are executed with the use of &&

postinstall: "some command && some other -c"
like image 143
Tucker Connelly Avatar answered Nov 20 '22 21:11

Tucker Connelly


I ran into this looking for something and thought this may help other people. I have found it easier to move to postinstall.js files as things get a little complicated. This makes it easier to deal with moving forward.

like image 34
Doug Avatar answered Nov 20 '22 21:11

Doug