从Strapi部署到Heroku的麻烦

时间:2020-11-08 17:58:02

标签: heroku deployment strapi

我已经在Strapi(CMS)上创建了一个项目,该项目链接到MongoDB,但是在Heroku上部署它遇到了一些麻烦。

我正在尝试部署在Heroku上创建的项目,但是这样做有些麻烦... 任何人都知道发生了什么事吗? 似乎与尖锐的“ darwin-x64”有关,但我真的不知道它是什么。

构建日志

-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       NODE_VERBOSE=false
       
-----> Installing binaries
       engines.node (package.json):  12.x
       engines.npm (package.json):   6.x
       
       Resolving node version 12.x...
       Downloading and installing node 12.19.0...
       Bootstrapping npm 6.x (replacing 6.14.8)...
       npm 6.x installed
       
-----> Restoring cache
       Cached directories were not restored due to a change in version of node, npm, yarn or stack
       Module installation may take longer for this build
       
-----> Installing dependencies
       Prebuild detected (node_modules already exists)
       Rebuilding any native modules
       
       > strapi@3.2.5 postinstall /tmp/build_384dada8_/node_modules/strapi
       > node lib/utils/success.js
       
       
       > core-js@2.6.11 postinstall /tmp/build_384dada8_/node_modules/core-js
       > node -e "try{require('./postinstall')}catch(e){}"
       
       
       > @fortawesome/fontawesome-free@5.15.1 postinstall /tmp/build_384dada8_/node_modules/@fortawesome/fontawesome-free
       > node attribution.js
       
       Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > @fortawesome/fontawesome-svg-core@1.2.32 postinstall /tmp/build_384dada8_/node_modules/@fortawesome/fontawesome-svg-core
       > node attribution.js
       
       Font Awesome Free 1.2.32 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > @fortawesome/fontawesome-common-types@0.2.32 postinstall /tmp/build_384dada8_/node_modules/@fortawesome/fontawesome-common-types
       > node attribution.js
       
       Font Awesome Free 0.2.32 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > @fortawesome/free-regular-svg-icons@5.15.1 postinstall /tmp/build_384dada8_/node_modules/@fortawesome/free-regular-svg-icons
       > node attribution.js
       
       Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > @fortawesome/free-solid-svg-icons@5.15.1 postinstall /tmp/build_384dada8_/node_modules/@fortawesome/free-solid-svg-icons
       > node attribution.js
       
       Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > @fortawesome/free-brands-svg-icons@5.15.1 postinstall /tmp/build_384dada8_/node_modules/@fortawesome/free-brands-svg-icons
       > node attribution.js
       
       Font Awesome Free 5.15.1 by @fontawesome - https://fontawesome.com
       License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
       
       
       > fsevents@1.2.13 install /tmp/build_384dada8_/node_modules/webpack-dev-server/node_modules/fsevents
       > node install.js
       
       
       Skipping 'fsevents' build as platform linux is not supported
       
       > fsevents@1.2.13 install /tmp/build_384dada8_/node_modules/webpack-dev-server/node_modules/fsevents
       > node install.js
       
       
       Skipping 'fsevents' build as platform linux is not supported
       
       > core-js@3.6.5 postinstall /tmp/build_384dada8_/node_modules/fbjs/node_modules/core-js
       > node -e "try{require('./postinstall')}catch(e){}"
       
       
       > sharp@0.26.2 install /tmp/build_384dada8_/node_modules/sharp
       > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
       
       ERR! sharp 'darwin-x64' binaries cannot be used on the 'linux-x64' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'linux-x64' platform.
       info sharp Attempting to build from source via node-gyp but this may fail due to the above error
       info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
       make: Entering directory '/tmp/build_384dada8_/node_modules/sharp/build'
         CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
         AR(target) Release/obj.target/../node-addon-api/nothing.a
         COPY Release/nothing.a
         TOUCH Release/obj.target/libvips-cpp.stamp
         CXX(target) Release/obj.target/sharp/src/common.o
         CXX(target) Release/obj.target/sharp/src/metadata.o
         CXX(target) Release/obj.target/sharp/src/stats.o
         CXX(target) Release/obj.target/sharp/src/operations.o
         CXX(target) Release/obj.target/sharp/src/pipeline.o
         CXX(target) Release/obj.target/sharp/src/utilities.o
         CXX(target) Release/obj.target/sharp/src/sharp.o
         SOLINK_MODULE(target) Release/obj.target/sharp.node
       /usr/bin/ld: cannot find -l:libvips-cpp.so.42
       /usr/bin/ld: cannot find -l:libvips.so.42
       collect2: error: ld returned 1 exit status
       sharp.target.mk:173: recipe for target 'Release/obj.target/sharp.node' failed
       make: *** [Release/obj.target/sharp.node] Error 1
       make: Leaving directory '/tmp/build_384dada8_/node_modules/sharp/build'
       gyp ERR! build error 
       gyp ERR! stack Error: `make` failed with exit code: 2
       gyp ERR! stack     at ChildProcess.onExit (/tmp/build_384dada8_/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
       gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
       gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
       gyp ERR! System Linux 4.4.0-1081-aws
       gyp ERR! command "/tmp/build_384dada8_/.heroku/node/bin/node" "/tmp/build_384dada8_/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
       gyp ERR! cwd /tmp/build_384dada8_/node_modules/sharp
       gyp ERR! node -v v12.19.0
       gyp ERR! node-gyp -v v5.1.0
       gyp ERR! not ok 
       npm ERR! code ELIFECYCLE
       npm ERR! errno 1
       npm ERR! sharp@0.26.2 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
       npm ERR! Exit status 1
       npm ERR! 
       npm ERR! Failed at the sharp@0.26.2 install script.
       npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
       
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.HAPvd/_logs/2020-11-08T17_37_15_574Z-debug.log
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       Some possible problems:
       
       - node_modules checked into source control
         https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

Strapi ===> package.json

    {
  "name": "strapi",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.5"
  },
  "dependencies": {
    "slugify": "^1.4.6",
    "strapi": "3.2.5",
    "strapi-admin": "3.2.5",
    "strapi-connector-mongoose": "3.2.5",
    "strapi-plugin-content-manager": "3.2.5",
    "strapi-plugin-content-type-builder": "3.2.5",
    "strapi-plugin-email": "3.2.5",
    "strapi-plugin-upload": "3.2.5",
    "strapi-plugin-users-permissions": "3.2.5",
    "strapi-provider-upload-cloudinary": "^3.2.5",
    "strapi-utils": "3.2.5"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "7c87552a-304d-4fdd-939f-96a5337bd377"
  },
  "engines": {
    "node": "12.x",
    "npm": "6.x"
  },
  "license": "MIT",
  "resolutions": {
    "chalk": "2.4.2",
    "chokidar": "3.4.3",
    "ci-info": "2.0.0",
    "commander": "6.1.0",
    "debug": "4.2.0",
    "koa-compose": "4.1.0",
    "lodash": "4.17.19",
    "qs": "6.9.4",
    "resolve-cwd": "3.0.0",
    "rimraf": "3.0.2",
    "ansi-styles": "3.2.1",
    "escape-string-regexp": "1.0.5",
    "supports-color": "5.5.0",
    "color-convert": "1.9.3",
    "color-name": "1.1.4",
    "anymatch": "3.1.1",
    "braces": "3.0.2",
    "glob-parent": "5.1.1",
    "is-binary-path": "2.1.0",
    "is-glob": "4.0.1",
    "normalize-path": "3.0.0",
    "readdirp": "3.3.0",
    "fsevents": "2.1.3",
    "fill-range": "7.0.1",
    "to-regex-range": "5.0.1",
    "is-number": "7.0.0",
    "binary-extensions": "2.1.0",
    "string-width": "4.2.0",
    "emoji-regex": "8.0.0",
    "is-fullwidth-code-point": "3.0.0",
    "strip-ansi": "5.2.0",
    "ansi-regex": "4.1.0",
    "semver": "5.7.1",
    "ms": "2.1.2",
    "pump": "3.0.0",
    "universalify": "1.0.0",
    "inherits": "2.0.4",
    "ansi-escapes": "3.2.0",
    "figures": "2.0.0",
    "iconv-lite": "0.4.24",
    "tslib": "1.14.1",
    "depd": "1.1.2",
    "http-errors": "1.8.0",
    "statuses": "1.5.0",
    "mime-db": "1.45.0",
    "safe-buffer": "5.1.2",
    "deep-equal": "1.0.1",
    "setprototypeof": "1.2.0",
    "raw-body": "2.4.1",
    "bytes": "3.1.0",
    "sprintf-js": "1.1.2",
    "path-to-regexp": "1.8.0",
    "isarray": "0.0.1",
    "buffer": "5.7.0",
    "is-wsl": "1.1.0",
    "resolve-from": "5.0.0",
    "p-map": "4.0.0",
    "extsprintf": "1.4.0",
    "cookie": "0.4.1",
    "lru-cache": "6.0.0",
    "yallist": "4.0.0",
    "chownr": "2.0.0",
    "mkdirp": "1.0.4",
    "immer": "7.0.14",
    "immutable": "3.8.2",
    "react-fast-compare": "3.2.0",
    "react-intl": "4.5.0",
    "react-redux": "7.2.0",
    "react-transition-group": "4.4.1",
    "reactstrap": "8.4.1",
    "sift": "13.1.10",
    "yup": "0.29.3",
    "json5": "2.1.3",
    "source-map": "0.5.7",
    "jsesc": "2.5.2",
    "core-js": "2.6.11",
    "es-abstract": "1.17.7",
    "deepmerge": "2.2.1",
    "dom-helpers": "5.2.0",
    "postcss": "7.0.35",
    "postcss-value-parser": "4.1.0",
    "loader-utils": "1.4.0",
    "pify": "4.0.1",
    "schema-utils": "2.7.1",
    "big.js": "5.2.2",
    "emojis-list": "3.0.0",
    "punycode": "1.4.1",
    "scheduler": "0.18.0",
    "toposort": "2.0.2",
    "htmlparser2": "3.10.1",
    "domutils": "1.5.1",
    "dom-serializer": "0.2.2",
    "domelementtype": "1.3.1",
    "entities": "1.1.2",
    "domhandler": "2.4.2",
    "readable-stream": "2.3.7",
    "string_decoder": "1.1.1",
    "jws": "3.2.2",
    "jwa": "1.4.1",
    "csstype": "3.0.4",
    "@formatjs/intl-displaynames": "1.2.10",
    "@formatjs/intl-listformat": "1.4.8",
    "@formatjs/intl-relativetimeformat": "4.5.16",
    "intl-messageformat": "8.4.1",
    "intl-messageformat-parser": "5.5.1",
    "is-arrayish": "0.2.1",
    "bluebird": "3.7.2",
    "mime": "2.4.6",
    "memory-fs": "0.4.1",
    "estraverse": "4.3.0",
    "define-property": "2.0.2",
    "extend-shallow": "3.0.2",
    "kind-of": "6.0.3",
    "isobject": "3.0.1",
    "is-extendable": "1.0.1",
    "is-descriptor": "1.0.2",
    "is-accessor-descriptor": "1.0.0",
    "is-data-descriptor": "1.0.0",
    "is-plain-object": "2.0.4",
    "has-value": "1.0.0",
    "has-values": "1.0.0",
    "util": "0.11.1",
    "bn.js": "5.1.3",
    "global-modules": "2.0.0",
    "global-prefix": "3.0.0",
    "wrap-ansi": "6.2.0",
    "array-flatten": "2.1.2",
    "faye-websocket": "0.10.0",
    "websocket-driver": "0.6.5",
    "fn-name": "3.0.0",
    "property-expr": "2.0.4",
    "mongoose": "5.10.8",
    "bl": "2.2.1",
    "libmime": "2.1.3",
    "simple-get": "4.0.0",
    "decompress-response": "6.0.0",
    "mimic-response": "3.1.0"
  }
}

谢谢您的帮助:)

1 个答案:

答案 0 :(得分:0)

您使用的环境之间似乎不匹配。请尝试以下操作:

  1. 从您的应用程序中完全删除图像。
addr = (short) (addr << 11);           // Gives 10101 00000000000, a negative number.
Integer.toBinaryString(addr)           // Sign-extends to "11111111111111111010100000000000"
addr = (short) Math.abs((addr >> 11)); // (addr >> 11) gets sign-extended: 
                                       // 11111111111 10101, meaning -11
                                       // abs() gives 00000000000 01011, meaning 11
  1. 然后尝试使用以下命令重新安装
npm uninstall sharp
  1. 然后在Heroku上重新部署
相关问题