Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在MERN(Nodejs&"x2B;React&"x2B;express&"x2B;mongodb&"x2B;Heroku上的Redux应用程序部署_Javascript_Reactjs_Heroku_Redux_Mern - Fatal编程技术网

Javascript 在MERN(Nodejs&"x2B;React&"x2B;express&"x2B;mongodb&"x2B;Heroku上的Redux应用程序部署

Javascript 在MERN(Nodejs&"x2B;React&"x2B;express&"x2B;mongodb&"x2B;Heroku上的Redux应用程序部署,javascript,reactjs,heroku,redux,mern,Javascript,Reactjs,Heroku,Redux,Mern,我正在构建一个MERN+redux应用程序,前端在react中,后端在node.js中 它在本地主机中运行良好,但当我尝试将其推送到heroku时,我遇到了这个问题。我一直在学习Brad Traversy关于MERN的课程,但我明白了,我不能继续了 这是我的package.json "scripts": { "client-install": "npm install --prefix client", "start": "node server.js",

我正在构建一个MERN+redux应用程序,前端在react中,后端在node.js中

它在本地主机中运行良好,但当我尝试将其推送到heroku时,我遇到了这个问题。我一直在学习Brad Traversy关于MERN的课程,但我明白了,我不能继续了

这是我的package.json

 "scripts": {
        "client-install": "npm install --prefix client",
        "start": "node server.js",
        "server": "nodemon server.js",
        "client": "npm start --prefix client",
        "dev": "concurrently \"npm run server\" \"npm run client\"",
        "heroku-postbuild": "NPM_CONFIG_PRODUCTION= false npm install --prefix client && npm run build --prefix client"
    },
    "dependencies": {
        "body-parser": "^1.19.0",
        "concurrently": "^5.1.0",
        "express": "^4.17.1",
        "mongoose": "^5.9.7"
    },
    "devDependencies": {
        "cz-conventional-changelog": "^3.1.0",
        "nodemon": "^2.0.2"
    },
    "config": {
        "commitizen": {
            "path": "./node_modules/cz-conventional-changelog"
        }
    }
这就是我得到的构建错误

    mbpdegobiaruben:MERN ShoppingList gchan$ git push heroku master
Enumerating objects: 143, done.
Counting objects: 100% (143/143), done.
Delta compression using up to 8 threads
Compressing objects: 100% (134/134), done.
Writing objects: 100% (143/143), 208.32 KiB | 5.48 MiB/s, done.
Total 143 (delta 63), 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):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:        
remote:        Resolving node version 12.x...
remote:        Downloading and installing node 12.16.2...
remote:        Using default npm version: 6.14.4
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules
remote:        
remote:        > core-js@2.6.11 postinstall /tmp/build_33801817cc54d90aaf94bfb41e439539/node_modules/core-js
remote:        > node -e "try{require('./postinstall')}catch(e){}"
remote:        
remote:        
remote:        > nodemon@2.0.2 postinstall /tmp/build_33801817cc54d90aaf94bfb41e439539/node_modules/nodemon
remote:        > node bin/postinstall || exit 0
remote:        
remote:        Love nodemon? You can now support the project via the open collective:
remote:         > https://opencollective.com/nodemon/donate
remote:        
remote:        added 419 packages in 8.418s
remote:        
remote: -----> Build
remote:        Running heroku-postbuild
remote:        
remote:        > mern-shoppinglist@1.0.0 heroku-postbuild /tmp/build_33801817cc54d90aaf94bfb41e439539
remote:        > NPM_CONFIG_PRODUCTION= false npm install --prefix client && npm run build --prefix client
remote:        
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! mern-shoppinglist@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION= false npm install --prefix client && npm run build --prefix client`
remote: npm ERR! Exit status 1
remote: npm ERR! 
remote: npm ERR! Failed at the mern-shoppinglist@1.0.0 heroku-postbuild 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.O2wff/_logs/2020-04-16T05_41_17_476Z-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 version not specified in package.json
remote:          https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
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 pacific-dawn-61320.
remote: 
To https://git.heroku.com/pacific-dawn-61320.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/pacific-dawn-61320.git'

您是否建立了github回购协议,我们可以在其中签出您的代码?@AtinSingh,开始吧!我检查了您的repo,在您的server.js中有
const db=require('./config/keys').mongoURI但你似乎没有任何配置文件夹。我检查了Brad的回复,他似乎有那个文件夹,他正在从..env那里取钥匙,你可以直接在heroku上提供。哦!那可能是!!!该死!!,我没有注意到,我稍后再查。谢谢你,伙计!您是否建立了github回购协议,我们可以在其中签出您的代码?@AtinSingh,开始吧!我检查了您的repo,在您的server.js中有
const db=require('./config/keys').mongoURI但你似乎没有任何配置文件夹。我检查了Brad的回复,他似乎有那个文件夹,他正在从..env那里取钥匙,你可以直接在heroku上提供。哦!那可能是!!!该死!!,我没有注意到,我稍后再查。谢谢你,伙计!