heroku部署错误npm ERR!代码ELIFECYCLE errno1

时间:2019-03-21 21:31:33

标签: node.js reactjs heroku deployment

我正在部署到Heroku,但在构建过程中出现Heroku Post Build Script后,我一直失败。

这是错误:

Counting objects: 31, done.
Delta compression using up to 8 threads.
Compressing objects:  33% (10/30)   Compressing objects:  36% (11/30)   Comp(13/30)   Compressing objects:  46% (14/30)   Compressing objects:  50% (15/cts:  56% (17/30)   Compressing objects:  60% (18/30)   Compressing objects:ssing objects:  70% (21/30)   Compressing objects:  73% (22/30)   Compressin)   Compressing objects:  83% (25/30)   Compressing objects:  86% (26/30)   93% (28/30)   Compressing objects:  96% (29/30)   Compressing objects: 100% Writing objects: 100% (31/31), 3.11 KiB | 795.00 KiB/s, done.
Total 31 (delta 24), reused 0 (delta 0)
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):  8.11.1
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 8.11.1...
remote:        Downloading and installing node 8.11.1...
remote:        Using default npm version: 5.6.0
remote:
remote: -----> Installing dependenciesremote:        Installing node modules (package.json + package-lock)
remote:
remote:        > nodemon@1.18.3 postinstall /tmp/build_cd1ff6a12b14a1453b116
remote:        > node bin/postinstall || exit 0remote:
remote:        Love nodemon? You can now support the project via the open co
remote:         > https://opencollective.com/nodemon/donate
remote:
remote:        added 416 packages in 10.469s
remote:
remote: -----> Build
remote:        Running heroku-postbuild
remote:
remote:        > mernsocial@1.0.0 heroku-postbuild /tmp/build_cd1ff6a12b14a1
remote:        > NPM_CONFIG_PRODUCTION=false npm install --prefix client && 
remote:
remote:        added 1876 packages in 59.275s
remote:
remote:        > client@0.1.0 build /tmp/build_cd1ff6a12b14a1453b116a9ef5be2
remote:        > react-scripts build
remote:
remote:        Creating an optimized production build...
remote:        Failed to compile.
remote:
remote:        ./src/components/dashboard/Dashboard.js
remote:        Cannot find file '../common/Spinner' in './src/components/das
remote:
remote:
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! client@0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the client@0.1.0 build script.ript.                                                npm. There is likely ad
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output abovound in:e.                                                  03-21T21_04_29_943Z-debu
remote:
remote: npm ERR! A complete log of this run can be found in:                                            `NPM_CONFIG_PRODUCTION=fremote: npm ERR!     /tmp/npmcache.Ac1YO/_logs/2019-03-21T21_04_29_943Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1                            ku-postbuild script.
remote: npm ERR! mernsocial@1.0.0 heroku-postbuild:  npm. There is likely ad
`NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`              ound in:
remote: npm ERR! Exit status 1                      03-21T21_04_29_957Z-debu
remote: npm ERR!
remote: npm ERR! Failed at the mernsocial@1.0.0 heroku-postbuild script.                                " script defined in pack
remote: npm ERR! This is probably not a problem with npm. There is likely ad 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.Ac1YO/_logs/2019-03-21T21_04_29_957Z-debu_29_957Z-debug.log
remote:remote: -----> Change to Node.js build process                 fined in pack
remote:        Heroku has begun executing the "build" script defined in package.json
remote:        during Node.js builds.remote:
remote:        Read more: https://devcenter.heroku.com/changelog-items/1573heroku.com/changelog-items/1573
remote: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-deploysremote:remote:        If you're stuck, please submit a ticket so we can help:remote:        https://help.heroku.com/remote:remote:        Love,remote:        Herokuremote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy...remote:remote: !       Push rejected to agile-shelf-15554.remote:
To https://git.heroku.com/agile-shelf-15554.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/agile-shelf-15554.git'
I double checked my Spinner Component, and the importation of the Spinner module.

这是我的文件夹结构的副本:

enter image description here

我已经检查以确保也导入了微调模块:

以下是在仪表板目录下的Dashboard.js文件中导入的模块:

import React, { Component } from 'react';
import { PropTypes } from 'prop-types';
import { connect } from 'react-redux';
import { getCurrentProfile, deleteAccount } from '../../actions/profileActions';
import { Link } from 'react-router-dom';
import ProfileActions from './ProfileActions';
import Spinner from '../common/Spinner';
import Experience from './Experience';
import Education from './Education';

我还回过头来仔细检查Spinner模块的导出:

这是Spinner模块代码:

import React from 'react';
import spinner from './spinner.gif';

export default () => {
  return (
    <div>
      <img
        src={spinner}
        style={{ width: '200px', margin: 'auto', display: 'block' }}
        alt="Loading....."
      />
    </div>
  );
};

我已经检查了StackOverFlow和几个GitDocs,其他的在文件结构和其他应用程序的后期构建方面也存在类似的问题,但是其中一些解决方案(围绕从不同分支推送到heroku方面)并不奏效。对我来说。

此外,我也可以在本地构建它,而不会出现任何错误。

感谢任何帮助,所以我可以完成这个项目。

谢谢

0 个答案:

没有答案