[英]Whenever I start my app using `npm start` it brings me to the Ruby on Rails Homescreen instead of my index.html file
I am new to software development, but I know how to use React/Redux
very well, as well as Ruby-On-Rails
.我是软件开发的新手,但我知道如何很好地使用
React/Redux
,以及Ruby-On-Rails
。 I am trying to have a React Frontend powered by a Rails backend.我正在尝试让一个由 Rails 后端提供支持的 React 前端。 I understand conceptually how
Node.js
works, but not exactly the minutia.我从概念上理解
Node.js
是如何工作的,但不完全是细节。 My app worked perfectly in the beginning stages before I committed any migrations, thus during testing I did not ever run rails s.
在我提交任何迁移之前,我的应用程序在开始阶段运行良好,因此在测试期间我从未运行过
rails s.
Now, whenever I do, as soon as I run npm start
it brings me to the rails homepage and nowhere in any of the code I've created.现在,每当我这样做时,一旦我运行
npm start
,它就会将我带到 Rails 主页,而我创建的任何代码都无处可去。 I've created apps before and never ran into this problem, and I know enough to surmise that the issue probably lies in the packagae.json
file inside the src directory, but other than that I have no idea what to do and no errors to even google.我以前创建过应用程序,但从未遇到过这个问题,而且我所知道的足以推测问题可能在于 src 目录中的
packagae.json
文件,但除此之外我不知道该怎么做,也没有错误甚至谷歌。 I don't even know what files or code I should be showing... regardless, here is my packagae.json file as my index.js
file我什至不知道我应该显示什么文件或代码......无论如何,这是我的 packagae.json 文件作为我的
index.js
文件
{
"name": "legend_of_cliches",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.4",
"react-scripts": "4.0.3",
"redux": "^4.1.1",
"redux-thunk": "^2.3.0",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import { Provider } from 'react-redux'
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import masterReducer from './reducers/master_reducer';
// Sets up Store and Debuggers
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const store = createStore(masterReducer, composeEnhancers(applyMiddleware(thunk)))
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.