【问题标题】:Laravel Elastic Beanstalk, cannot install-run npm?Laravel Elastic Beanstalk,无法安装运行 npm?
【发布时间】:2018-01-29 13:39:53
【问题描述】:

我的 Elastic Beanstalk 与 Laravel 5.4 这是我的 02-node.config:

commands:
  01-install-node:
    command: "curl --silent --location https://rpm.nodesource.com/setup_8.x | s$
    command: "sudo yum -y install nodejs"

还有 03-deploy.config

container_commands:
  01-laravel-deploy:
    command: "php artisan migrate"
    command: "php artisan config:clear"
    command: "php artisan config:cache"
    command: "php artisan route:clear"
    command: "php artisan route:cache"
    command: "npm install"
    command: "npm run prod"

在部署期间我得到:

ERROR: [Instance: i-018d9dd563f6ba0e6] Command failed on instance. Return code: 1 Output: (TRUNCATED)...ar/app/ondeck
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR! syscall spawn
npm ERR! code ENOENT
npm ERR! errno ENOENT
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-laravel-deploy in .ebextensions/03-deploy.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
ERROR: Unsuccessful command execution on instance id(s) 'i-018d9dd563f6ba0e6'. Aborting the operation.
ERROR: Failed to deploy application.

有人知道为什么会这样吗?

【问题讨论】:

    标签: node.js laravel amazon-web-services npm amazon-linux


    【解决方案1】:

    这一行:

    command: "curl --silent --location https://rpm.nodesource.com/setup_8.x | s$
    

    没有任何意义。双引号未关闭,您将其重定向到s$,但您应该重定向到bash,所以:

    command: "curl -sL https://rpm.nodesource.com/setup_8.x | bash -E -"
    

    有关错误的更多详细信息,请按照建议检查:npm-debug.log 和 eb-activity.log。

    【讨论】:

      【解决方案2】:

      问题是因为 npm 没有进行 npm 安装的权限。检查此link 以获得正确的解决方案。

      【讨论】:

        猜你喜欢
        • 2018-04-12
        • 2016-03-11
        • 2018-12-10
        • 2015-01-15
        • 1970-01-01
        • 2017-07-24
        • 2016-11-08
        • 2014-10-15
        • 2017-08-27
        相关资源
        最近更新 更多