Разверните Node.js на Heroku Ошибка:! [удаленный отклонен] master -> master (обработчик предварительного приема отклонен) - PullRequest
0 голосов
/ 25 марта 2020

При попытке развернуть приложение React на Heroku я получаю следующую ошибку. Я переместил node_modules в .gitignore, установил пакет сборки Heroku nodejs и обновил до последних версий узла и npm, убедившись, что они соответствуют моему списку движков в package.json. Я не могу понять, что вызывает это

Enumerating objects: 29163, done.
Counting objects: 100% (29163/29163), done.
Delta compression using up to 4 threads
Compressing objects: 100% (21337/21337), done.
Writing objects: 100% (29163/29163), 31.64 MiB | 711.00 KiB/s, done.
Total 29163 (delta 6397), reused 29163 (delta 6397)
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_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:        
remote: -----> Installing binaries
remote:        engines.node (package.json):  12.16.1
remote:        engines.npm (package.json):   6.4.1
remote:        
remote:        Resolving node version 12.16.1...
remote:        Downloading and installing node 12.16.1...
remote:        Bootstrapping npm 6.4.1 (replacing 6.13.4)...
remote:        npm 6.4.1 installed
remote:        
remote: -----> Installing dependencies
remote:        Prebuild detected (node_modules already exists)
remote:        Rebuilding any native modules
remote:        
remote:        > core-js-pure@3.6.4 postinstall /tmp/build_b4eb2781076772d39a0d97bcbfa078c6/node_modules/core-js-pure
remote:        > node -e "try{require('./postinstall')}catch(e){}"
remote:        
remote:        
remote:        > core-js@3.6.4 postinstall /tmp/build_b4eb2781076772d39a0d97bcbfa078c6/node_modules/core-js
remote:        > node -e "try{require('./postinstall')}catch(e){}"
remote:        
remote:        
remote:        > core-js@2.6.11 postinstall /tmp/build_b4eb2781076772d39a0d97bcbfa078c6/node_modules/babel-runtime/node_modules/core-js
remote:        > node -e "try{require('./postinstall')}catch(e){}"
remote:        
remote:        Installing any new modules (package.json)
remote:        audited 930385 packages in 17.403s
remote:        found 0 vulnerabilities
remote:        
remote:        
remote: -----> Build
remote:        Running build
remote:        
remote:        > project-x@0.1.0 build /tmp/build_b4eb2781076772d39a0d97bcbfa078c6
remote:        > react-scripts build
remote:        
remote:        Creating an optimized production build...
remote:        Failed to compile.
remote:        
remote:        ./src/SocialFollow.js
remote:        Cannot find module: '@fortawesome/react-fontawesome'. Make sure this package is installed.
remote:        
remote:        You can install this package by running: npm install @fortawesome/react-fontawesome.
remote:        
remote:        
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! project-x@0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR! 
remote: npm ERR! Failed at the project-x@0.1.0 build script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote: 
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.ce7js/_logs/2020-03-25T00_48_13_911Z-debug.log
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:        Some possible problems:
remote:        
remote:        - node_modules checked into source control
remote:          https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
remote:        
remote:        - A module may be missing from 'dependencies' in package.json
remote:          https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies
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 hidden-stream-53835.
remote: 
To https://git.heroku.com/hidden-stream-53835.git
 ! [remote rejected]   master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/hidden-stream-53835.git'

package.json

{
  "name": "project-x",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "npm": "6.4.1",
    "node": "12.16.1"
  },
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

Ответы [ 2 ]

1 голос
/ 25 марта 2020

Не удается найти модуль: '@ fortawesome / реагировать-fontawesome'. Убедитесь, что этот пакет установлен.

Этот пакет не указан в вашем "dependencies".

Добавьте его, запустив yarn add @fortawesome/react-fontawesome или npm install --save @fortawesome/react-fontawesome и повторно разверните.

0 голосов
/ 03 апреля 2020

вам нужно добавить версию узла и npm вашего проекта: добавьте эту строку в пакет. json "engine": {"node": "10.16.3", "npm": " 6,9,0 "},

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...