首页 > 解决方案 > Heroku 无法构建 -Node

问题描述

我正在尝试通过heroku托管我的网站,但是无论我做什么,构建都会不断失败。构建在本地工作,但是当我尝试推送到heroku时,我不断得到这个

Counting objects: 1324, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (609/609), done.
Writing objects: 100% (1324/1324), 28.24 MiB | 0 bytes/s, done.
Total 1324 (delta 681), reused 1324 (delta 681)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  ^10.7
remote:        engines.npm (package.json):   unspecified (use default)
remote:        engines.yarn (package.json):  ^1.5
remote:
remote:        Resolving node version ^10.7...
remote:        Downloading and installing node 10.9.0...
remote:        Using default npm version: 6.2.0
remote:        Resolving yarn version ^1.5...
remote:        Downloading and installing yarn (1.9.4)...
remote:        Installed yarn 1.9.4
remote:
remote: -----> Restoring cache
remote:        Skipping cache restore (not-found)
remote:
remote: -----> Building dependencies
remote:        Installing node modules (yarn.lock)
remote:        yarn install v1.9.4
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        warning Pattern ["@types/koa@latest"] is trying to unpack in the same destination "/tmp/yarncache.80EhH/v2/npm-@types/koa-2.0.46-24bc3cd405d10fcde81f876cd8285
b44d4ddc3e9" as pattern ["@types/koa@*","@types/koa@*","@types/koa@*","@types/koa@*","@types/koa@*","@types/koa@*","@types/koa@*","@types/koa@*","@types/koa@*"]. This could
result in non-deterministic behavior, skipping.
remote:        warning Pattern ["@types/node@latest"] is trying to unpack in the same destination "/tmp/yarncache.80EhH/v2/npm-@types/node-10.9.2-f0ab8dced5cd6c56b26765e1c0d
9e4fdcc9f2a00" as pattern ["@types/node@*","@types/node@*","@types/node@*","@types/node@*","@types/node@*","@types/node@*","@types/node@*","@types/node@*","@types/node@*","@
types/node@*","@types/node@*","@types/node@*","@types/node@*","@types/node@*","@types/node@*"]. This could result in non-deterministic behavior, skipping.
remote:        warning Pattern ["koa-convert@latest"] is trying to unpack in the same destination "/tmp/yarncache.80EhH/v2/npm-koa-convert-1.2.0-da40875df49de0539098d1700b50
820cebcd21d0" as pattern ["koa-convert@^1.2.0"]. This could result in non-deterministic behavior, skipping.
remote:        warning Pattern ["qs@latest"] is trying to unpack in the same destination "/tmp/yarncache.80EhH/v2/npm-qs-6.5.2-cb3ae806e8740444584ef154ce8ee98d403f3e36" as p
attern ["qs@^6.4.0"]. This could result in non-deterministic behavior, skipping.
remote:        (node:257) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or
Buffer.from() methods instead.
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        error An unexpected error occurred: "ENOENT: no such file or directory, scandir '/tmp/yarncache.80EhH/v2/npm-path-key-2.0.1-411cadb574c5a140d3a4b1910d40d80cc9
f40b40'".
remote:        info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_11ee5794ef73ae92c415ea71c412314f/yarn-error.log".
remote:        info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
remote:
remote: -----> Build failed
remote:
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:
remote:        Love,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to sun-it-solution.
remote:
To https://git.heroku.com/sun-it-solution.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/sun-it-solution.git'

我也尝试运行yarn cache clean,删除所有node_modules并运行yarn install,但构建仍然失败
我被困在这里:(我也搜索了一些其他的东西,但我无法解决问题请帮忙

标签: herokunode-modules

解决方案


推荐阅读