node.js - npm 错误!代码 ELIFECYCLE npm 安装后脚本

标签 node.js heroku npm

嗨,我正在尝试将 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 中,我有一个安装后任务,它运行“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");

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

最佳答案

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

.minifyCss({processImport: false}))  

关于node.js - npm 错误!代码 ELIFECYCLE npm 安装后脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31140246/

相关文章:

ruby-on-rails - Heroku:部署 ruby​​ 应用程序后为 "Process exited with status 127"

node.js - Node 包 'node-fetch' 语法错误 : Unexpected identifier

node.js - Arangojs - Firebase 云功能 => 无法连接到我的数据库

node.js - 语法错误: Unexpected end of JSON input while parsing near '…: {"name":"@babel/plug' ?

ruby-on-rails - 有什么方法可以从 heroku 提供 gzip Assets ?

mysql - 托管在 Heroku 上的 Rails 应用程序的地理空间和全文搜索

html - 有没有一个包可以将内联样式转换为 css 类

vue.js - 在 nativescript-vue 应用程序中哪里安装 axios?

node.js - 未找到 Gulp 命令

node.js - 如何在 firebase 中获取当前更新值