如何在Amazon弹性魔豆与.ebextensions运行`NPM install`

编程入门 行业动态 更新时间:2024-10-09 00:45:21

如何在Amazon<a href=https://www.elefans.com/category/jswz/34/1771280.html style=弹性魔豆与.ebextensions运行`NPM install`"/>

如何在Amazon弹性魔豆与.ebextensions运行`NPM install`

我想与eb deploy命令部署在亚马逊弹性魔豆我的PHP应用程序。但是我的应用程序使用一饮而尽到Concat的,然后再缩小SCSS和JS。

所以,我在文件.ebextensios/03npm.config尝试这些命令

commands:
  01-install-node:
    command: "yum install nodejs npm --enablerepo=epel -y"

container_commands:
  01-install-dependencies:
    command: "npm install"
  02-build:
    command: "npm run build"

但最后我收到此错误

[Instance: i-c7800103] Command failed on instance. Return code: 1 Output: (TRUNCATED)...ttps://registry.npmjs/acorn npm http 304  npm http 304  npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /var/app/ondeck/npm-debug.log npm ERR! not ok code 0. container_command 01-install-dependencies in .ebextensions/03npm.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

我不知道,但似乎npm install从一个包,可以忽略不计,但它正在调度EB错误,并停止整个过程中收到错误。

我用这台机器上运行:64bit Amazon Linux 2015.09 v2.0.4 running PHP 5.6

有谁知道我们如何解决这一问题?

回答如下:

到现在为止,我有这个丑陋的解决方案,但它的工作原理。我创建了里面的package.json是做艰苦的工作顺序此脚本。它创建一个新的分支,前提交编译的文件部署到EB

的package.json

{
  "scripts": {
    "production": "node ./node_modules/gulp/bin/gulp.js --production",
    "deploy": "git checkout -b deploy && npm run production && git add . && git commit -m \"build\" && eb deploy && git checkout master && git branch -D deploy"
  }
}

.elasticbeanstalk / config.yml

branch-defaults:
  deploy:
    environment: NAME_OF_ENVIRONMENT

更多推荐

如何在Amazon弹性魔豆与.ebextensions运行`NPM install`

本文发布于:2024-05-06 17:32:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1753613.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹性   魔豆   如何在   Amazon   install

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!