heroku deployment error npm ERR! code ELIFECYCLE errno1

送分小仙女□ 提交于 2020-01-25 10:14:28

问题


I'm working on my deployment to Heroku, and I keep failing after the Heroku Post Build Script during the building.

Here is the error:

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.

Here is a copy of my folder structure:

I've checked to make sure that I was importing the Spinner Module as well:

Here is the module imports in the Dashboard.js file within the dashboard directory:

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';

I've also went back to double check the exporting of the Spinner module:

Here is the Spinner module code:

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>
  );
};

I've checked StackOverFlow and a couple of GitDocs, and other were having similar problems with file structure and post build for other apps, but some of those solutions (revolved around pushing to heroku from a different branch) weren't fruitful for me.

Also, I'm able to build it locally without any errors too.

Any help appreciated so I can complete this project.

Thank You,

来源:https://stackoverflow.com/questions/55289553/heroku-deployment-error-npm-err-code-elifecycle-errno1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!