简体   繁体   English

尝试将我的应用程序(Node,React,Socketio)部署到Heroku会给我“ sh:1:react-scripts:权限被拒绝”

[英]Attempting to deploy my app (Node, React, Socketio) to Heroku gives me “sh: 1: react-scripts: Permission denied”

So I am trying to make my first react app. 因此,我正在尝试制作我的第一个React应用。 I have it working just fine locally. 我在本地工作得很好。 The problem is that I cannot upload my project to Heroku. 问题是我无法将项目上传到Heroku。

This is my app setup: my file arrangement . 这是我的应用设置: 我的文件排列 I built this starting with a create-react-app, wrapped that entire thing in a "client" folder, and created a normal node server arrangement outside . 我从create-react-app开始构建了该应用程序,将整个内容包装在“ client”文件夹中,并在外部创建了常规的节点服务器布置。 I haven't touched my react app's package.json" except to add a socketio dependency, other than that it is exactly what create-react-app spits out. 除了添加socketio依赖项外,我没有碰过我的React应用程序的package.json”,除了它正是create-react-app吐出的东西。

I get this error on console when attempting to upload: "sh: 1: react-scripts: Permission denied" 尝试上传时,我在控制台上收到此错误: “ sh:1:react-scripts:权限被拒绝”

I have gone through https://devcenter.heroku.com/articles/nodejs-support , but to no avail. 我已经经历过https://devcenter.heroku.com/articles/nodejs-support ,但无济于事。

This is my "outside" package.json scripts and dependencies 这是我的“外部” package.json脚本和依赖项

"scripts": {
    "client": "npm start --prefix client",
    "server": "node server.js",
    "start": "concurrently \"npm run server\" \"npm run client\"",
    "heroku-postbuild": "cd client && npm run build"
},
"dependencies": {
    "concurrently": "^4.0.1",
    "express": "^4.16.4"
    "socket.io": "^2.1.1"
}

UPDATE: 更新:

I've not gotten my application to work yet HOWEVER I finally found something interesting. 我还没有使我的应用程序正常工作,但是我终于找到了一些有趣的东西。

This: https://github.com/mars/heroku-cra-node 这个: https : //github.com/mars/heroku-cra-node

Looks like a barebones application I can essentially my stuff to, and have it work on Heroku. 看起来像一个准系统应用程序,我基本上可以将其应用到该程序中,并使它在Heroku上运行。 I've not added my code yet, I'll report back. 我还没有添加代码,我会报告。

UPDATE: 更新:

Yep, seems to get past this permission BS. 是的,似乎已经超出了此许可BS。 Now I just have to deal with getting socket.io client to connect... -_- 现在我只需要处理使socket.io客户端连接... -_-

Change your script to this: 将脚本更改为此:

  "scripts": {
    "start": "node index.js",
    "server": "nodemon index.js",
    "client": "npm run start --prefix client",
    "dev": "concurrently \"npm run server\" \"npm run client\"",
    "heroku-postbuild": "NPM_PRODUCTION=false npm install --prefix client && npm run build --prefix client",
  },

npm run dev will start your server and client in development mode... npm run dev将以开发模式启动您的服务器和客户端。

You can also install nodemon to make your life easier... 您也可以安装nodemon简化生活...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 由于这个“远程:sh:1:react-scripts:权限被拒绝错误”,正在努力将我的反应项目部署到 heroku - Struggling to deploy my react project to heroku due to this `remote: sh: 1: react-scripts: Permission denied error` Heroku 构建失败 [sh: 1: react-scripts: Permission denied] - Heroku Build Fail [sh: 1: react-scripts: Permission denied] "npm run build" = "react-scripts: Permission denied" - "npm run build" = "react-scripts: Permission denied" 尝试将 MERN 应用程序部署到 Now (zeit.co) 时出现“sh: react-scripts: command not found”错误 - Getting 'sh: react-scripts: command not found' error when trying to deploy MERN app to Now (zeit.co) 为什么“npm run build”会产生错误“react-scripts Permission denied”? - why does “npm run build” produce error “react-scripts Permission denied”? sh: /Users/mac/Desktop/LOGIC/node_modules/.bin/react-scripts: /bin/sh^M: 错误的解释器:没有这样的文件或目录 - sh: /Users/mac/Desktop/LOGIC/node_modules/.bin/react-scripts: /bin/sh^M: bad interpreter: No such file or directory 运行“npm run build”后“sh: 1: react-scripts: not found” - "sh: 1: react-scripts: not found" after running "npm run build" npm start throws sh: react-scripts: command not found - npm start throws sh: react-scripts: command not found 反应脚本无法识别 - react-scripts is not recognize 我在创建 React 应用程序时出错,可能是由于我的 react-scripts 中的问题 - I am having an error creating a react app in my probably due to an issue in my react-scripts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM