node.js - How to write a Npm Script Command that works cross platform -


i'm trying write postinstall command works openshift install bower dependancies. i've managed working great.

"scripts": {     "postinstall": "home=$openshift_repo_dir bower install" } 

i'm trying improve command can run following command locally on windows pc.

npm install 

it throws error:

ps d:\dev\cgb14\code\trunk\solution\app> npm install  > warcher_app@1.0.0 postinstall d:\dev\cgb14\code\trunk\solution\app > home=$openshift_repo_dir node_modules/.bin/bower install  'home' not recognized internal or external command, operable program or batch file.  npm err! windows_nt 6.3.9600 npm err! argv "d:\\program files\\nodejs\\\\node.exe" "d:\\program files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "ins tall" npm err! node v0.12.4 npm err! npm  v2.10.1 npm err! code elifecycle npm err! warcher_app@1.0.0 postinstall: `home=$openshift_repo_dir node_modules/.bin/bower install` npm err! exit status 1 npm err! npm err! failed @ warcher_app@1.0.0 postinstall script 'home=$openshift_repo_dir node_modules/.bin/bower install'. npm err! problem warcher_app package, npm err! not npm itself. npm err! tell author fails on system: npm err!     home=$openshift_repo_dir node_modules/.bin/bower install npm err! can info via: npm err!     npm owner ls warcher_app npm err! there additional logging output above.  npm err! please include following file support request: npm err!     d:\dev\cgb14\code\trunk\solution\app\npm-debug.log 

does know how can improve postinstall script work on windows too?

i've been searching documentation on npm command can take , see if there cross platform if exists statement. thinking should if $openshift_repo_dir exists, this... else else...

right, 5 minutes after posted thought of hadn't tried yet. simple or in command worked. can run on both windows , openshift

"scripts": {   "postinstall": "home=$openshift_repo_dir bower install || bower install" } 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -