部署到 elastic beanstalk "Refusing to delete" 的部署问题

Deploy issues with deploying to elastic beanstalk "Refusing to delete"

您好,我在尝试将我的新代码部署到我们的测试环境时偶然发现了这个错误,但它突然崩溃了。

在我的机器上工作得很好,但在 AWS 上突然在部署时崩溃。

eb-activity.log

  npm ERR! path /tmp/deployment/application/node_modules/hummus/node_modules/.bin/node-pre-gyp
  npm ERR! code EEXIST
  npm ERR! Refusing to delete /tmp/deployment/application/node_modules/hummus/node_modules/.bin/node-pre-gyp: is outside /tmp/deployment/application/node_modules/hummus/node_modules/node-pre-gyp and not a link
  npm ERR! File exists: /tmp/deployment/application/node_modules/hummus/node_modules/.bin/node-pre-gyp

深入查看它所说的日志

/tmp/.npm/_logs/2019-01-21T12_50_51_067Z-debug.log

624 verbose unbuild rmStuff node-pre-gyp@0.10.3 from /tmp/deployment/application/node_modules
625 verbose unbuild rmStuff in /tmp/deployment/application/node_modules/hummus/node_modules
626 silly isEverInside /tmp/deployment/application/node_modules/hummus/node_modules/.bin/node-pre-gyp is not inside /tmp/deployment/application/node_modules/hummus/node_modules/node-pre-gyp
627 silly gentlyRm parent.path = /tmp/deployment/application/node_modules/hummus/node_modules/node-pre-gyp
628 silly gentlyRm parent.managed = /tmp/deployment/application/node_modules/hummus/node_modules/node-pre-gyp is in /tmp/deployment/application
629 silly gentlyRm target.path =  /tmp/deployment/application/node_modules/hummus/node_modules/.bin/node-pre-gyp
630 silly gentlyRm target.symlink = null
631 silly gentlyRm target.managed = /tmp/deployment/application/node_modules/hummus/node_modules/.bin/node-pre-gyp is in /tmp/deployment/application
632 silly gentlyRm target.inParent =  false
633 verbose unlock done using /tmp/.npm/_locks/staging-6d252812679aa9c6.lock for /tmp/deployment/application/node_modules/.staging
634 verbose stack Error: Refusing to delete /tmp/deployment/application/node_modules/hummus/node_modules/.bin/node-pre-gyp: is outside /tmp/deployment/application/node_modules/hummus/node_modules/node-pre-gyp and not a link

我让 CodeShip 部署所有代码,打包 node_modules 并将其上传到 AWS。

但是现在当我尝试做一个 $ eb deploy DEV-APP --profile dev 时它工作得很好。

  > hummus@1.0.95 install /tmp/deployment/application/node_modules/hummus
  > node-pre-gyp install --fallback-to-build $EXTRA_NODE_PRE_GYP_FLAGS

  node-pre-gyp WARN Using request for node-pre-gyp https download
  [hummus] Success: "/tmp/deployment/application/node_modules/hummus/binding/hummus.node" already installed
  Pass --update-binary to reinstall or --build-from-source to recompile

仅当我让 CodeShip 进行部署时,它根本不起作用。

好的,所以我确实得出结论,我自己的部署没有将 node_modules 添加到 CodeShip 添加的 S3 存储桶中。

因此,在部署到 elastic beanstalk 之前,我刚刚添加了一个部署脚本来删除 node_modules