【问题标题】:npm ERR! code ELIFECYCLE npm postinstall scriptnpm 错误!代码 ELIFECYCLE npm 安装后脚本
【发布时间】:2015-08-05 08:09:05
【问题描述】:

您好,我正在尝试将一个 npm/bower/gulp 项目部署到 heroku,但我遇到了一个非常普遍的错误,我也在本地运行

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

完整的 npm-debug.log 可以在 https://gist.github.com/sjmcpherso/64be7626f37b3f296bb2 以及我的 package.json 中找到

在我的 package.json 中,我有一个 postinstall 任务,它运行“bower install”,然后运行“gulp build”,如果我单独运行它们,它们都可以正常工作

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

heroku 上的错误类似

   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

希望有人能帮忙,谢谢

更新:

我发现问题与在我的 Sass 文件中使用外部导入有关

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

删除这个导入并且它没有错误,这肯定是一个错误,但我不确定哪个包都是最新的

【问题讨论】:

  • 如果您暂时删除postinstall 行,并在npm install 之后手动运行bower installgulp build...会发生什么?您是否将跟踪/提交凉亭安装的目录作为您的回购的一部分?

标签: node.js heroku npm


【解决方案1】:

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

.minifyCss({processImport: false}))  

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-08
    • 1970-01-01
    • 1970-01-01
    • 2019-04-14
    • 2019-08-20
    • 2019-02-04
    • 2017-11-15
    • 2021-01-18
    相关资源
    最近更新 更多