Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.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 Heroku构建失败[sh:1:react脚本:权限被拒绝]_Javascript_Node.js_Heroku - Fatal编程技术网

Javascript Heroku构建失败[sh:1:react脚本:权限被拒绝]

Javascript Heroku构建失败[sh:1:react脚本:权限被拒绝],javascript,node.js,heroku,Javascript,Node.js,Heroku,简介: 我最近完成了MERN stack课程,打算将我的构建推送到Heroku,但遇到了上面的错误。我最初认为这是一个VisualStudio权限错误,所以我使用提升的权限运行vs代码。然而,这并没有起作用 我尝试过,但没有成功: 将nodejs脚本构建包添加到我的部署中 修改my package.json以合并选择要运行的node.js版本的引擎 在脚本部分,将.js扩展添加到服务器端,认为这可能有一个简单的问题 仔细检查我的本地实例是否正常工作(确实如此) 立即将我的电脑扔出窗外(感觉很好,

简介:

我最近完成了MERN stack课程,打算将我的构建推送到Heroku,但遇到了上面的错误。我最初认为这是一个VisualStudio权限错误,所以我使用提升的权限运行vs代码。然而,这并没有起作用

我尝试过,但没有成功:

  • 将nodejs脚本构建包添加到我的部署中
  • 修改my package.json以合并选择要运行的node.js版本的引擎
  • 在脚本部分,将.js扩展添加到服务器端,认为这可能有一个简单的问题
  • 仔细检查我的本地实例是否正常工作(确实如此)
  • 立即将我的电脑扔出窗外(感觉很好,但仍然无法工作)

  • 请参阅此链接,了解如何检查文件的正确权限以及如何设置权限()

    我查看了您的GitHub,它似乎是您的
    文件中的一个简单输入错误。gitignore
    文件:

    node\u模块/
    config/default.json

    这应该是:

    node\u模块/
    config/default.json

    请注意
    node\u modules
    文件夹的名称,因此快速修复方法是编辑
    .gitignore
    文件并输入wright名称,然后运行以下操作:

    • git rm-r--缓存的节点\u模块
    • 删除根目录中以及客户端中的节点\u模块/
    • git提交-am“忽略节点模块”
      最后推送您的更改,这将修复错误
    sh:1:react脚本:权限被拒绝


    所以这是一个权限问题。转到包含
    react scripts
    的正确路径,执行
    chmod+x react scripts
    将解决此问题。

    未使用Heroku,但从日志中,我认为在正确的目录中
    chmod+x react scripts
    将解决此问题。您是正确的,这是一个chmod错误。我已经删除了以前的回复,谢谢!感谢您的回复,虽然它仍然不起作用,但我假设它只是另一个简单的打字错误,我必须弄清楚。抱歉,我忘记了您需要删除根目录中以及客户端目录中的node_模块,因为它以前被推送到repo,它一定不在那里,我编辑了答案,基本上,这就是我首先注意到的,我认为这是原因,但是它可能是另外一回事,当你解决错误时,请考虑如何完成它。我终于成功部署了,谢谢你的帮助。没有其他的打字错误,我有一些奇怪的问题与我的monogURI有关。解决方案是在参考资料中安装mLab MongoDB作为免费插件,从“reveal config vars”下的设置复制monogdb_uri,并将新的monogURI粘贴到我的production.json文件中。
        ----> Node.js app detected
    
    -----> Creating runtime environment
    
           NPM_CONFIG_LOGLEVEL=error
           NODE_ENV=production
           NODE_MODULES_CACHE=true
           NODE_VERBOSE=false
    
    -----> Installing binaries
           engines.node (package.json):  unspecified
           engines.npm (package.json):   unspecified (use default)
    
           Resolving node version 12.x...
           Downloading and installing node 12.13.0...
           Using default npm version: 6.12.0
    
    -----> Installing dependencies
           Prebuild detected (node_modules already exists)
           Rebuilding any native modules
    
           > nodemon@1.19.3 postinstall /tmp/build_33db88ab97938128199a401d17366aac/node_modules/nodemon
           > node bin/postinstall || exit 0
    
           Love nodemon? You can now support the project via the open collective:
    
    
              > https://opencollective.com/nodemon/donate
    
    //REMOVED INSTALLATION TEXT HERE DUE TO CHAR LIMIT
    
    
    -----> Build
           Running heroku-postbuild
    
           > website_setup@1.0.0 heroku-postbuild /tmp/build_33db88ab97938128199a401d17366aac
           > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
    
           audited 905041 packages in 14.447s
           found 1 moderate severity vulnerability
             run `npm audit fix` to fix them, or `npm audit` for details
    
           > client@0.1.0 build /tmp/build_33db88ab97938128199a401d17366aac/client
           > react-scripts build
    
    sh: 1: react-scripts: Permission denied
    npm ERR! code ELIFECYCLE
    npm ERR! errno 126
    npm ERR! client@0.1.0 build: `react-scripts build`
    npm ERR! Exit status 126
    npm ERR! 
    npm ERR! Failed at the client@0.1.0 build script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /tmp/npmcache.1egfD/_logs/2019-11-08T01_04_59_454Z-debug.log
    npm ERR! code ELIFECYCLE
    npm ERR! errno 126
    npm ERR! website_setup@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
    npm ERR! Exit status 126
    npm ERR! 
    npm ERR! Failed at the website_setup@1.0.0 heroku-postbuild script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /tmp/npmcache.1egfD/_logs/2019-11-08T01_04_59_470Z-debug.log
    -----> Build failed
    
    
           We're sorry this build is failing! You can troubleshoot common issues here:
           https://devcenter.heroku.com/articles/troubleshooting-node-deploys
    
           Some possible problems:
    
           - node_modules checked into source control
             https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
    
           - Node version not specified in package.json
             https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
    
           Love,
           Heroku
    
     !     Push rejected, failed to compile Node.js app.
     !     Push failed