npm ERR! code ELIFECYCLE npm postinstall script

时间:2015-06-30 13:54:20

标签: node.js heroku npm

Hi Im trying to deploy a npm/bower/gulp project to heroku, but I'm getting a very generic error which I get running locally as well

npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/Users/admin/.node/bin/npm" "install"
npm ERR! node v0.10.33
npm ERR! npm  v2.1.9
npm ERR! code ELIFECYCLE
npm ERR! @ postinstall: `bower install && gulp build`
npm ERR! Exit status 1

The full npm-debug.log can be found at https://gist.github.com/sjmcpherso/64be7626f37b3f296bb2 as well as my package.json

In my package.json I have a postinstall task which runs 'bower install' and then 'gulp build', if I run these individually they all work fine

"private": true,
  "engines": {
  "node": ">=0.10.0"
},
"main": "server.js",
"scripts": {
  "start": "node server.js",
  "postinstall": "bower install && gulp build"
},

On heroku the error is similar

   npm ERR! Linux 3.13.0-49-generic
   npm ERR! argv "/tmp/build_3c30c62b654a8b995e1a813913a68a7d/.heroku/node/bin/node" "/tmp/build_3c30c62b654a8b995e1a813913a68a7d/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_3c30c62b654a8b995e1a813913a68a7d/.npmrc"
   npm ERR! node v0.12.5
   npm ERR! npm  v2.11.2
   npm ERR! code ELIFECYCLE
   npm ERR! @ postinstall: `bower install && gulp build`
   npm ERR! Exit status 1

Hope someone can help, thanx

UPDATE:

I found the issue is related to use of an external import in my Sass file

@import url("https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin");

Remove this import and its error free, this is certainly a bug but I'm not certain which package as all are upto date

1 个答案:

答案 0 :(得分:2)

在gulp-minify-css中将processImport标志设置为false允许我包含字体导入,因为在此之前处理.scss导入它不会影响它们

.minifyCss({processImport: false}))