[英]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.