简体   繁体   English

每当我使用 `npm start` 启动我的应用程序时,它都会将我带到 Rails 主屏幕上的 Ruby 而不是我的 index.html 文件

[英]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文件

package.json package.json

{
  "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"
    ]
  }
}

index.js索引.js

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.

相关问题 当我运行 npm 启动时,我的 webpack 找不到我的索引。html 页面 - my webpack cannot find my index.html page when I run npm start 我可以在没有 npm 启动和 npx create-react-app 的情况下使用 React 运行 index.html 吗? - Can I run index.html with React without npm start and npx create-react-app? 为什么我的 index.html 文件在我调试或预览时返回空白屏幕? - why is my index.html file returning a blank screen whenever i debug or preview it? 为什么 fetch 返回我的 React 应用程序的 index.html 而不是我提供的 URL? - Why is fetch returning my React app's index.html instead of the URL I provided? Electron 项目:打开 index.html 或 npm start,有什么变化? - Electron project : open index.html or npm start, what changes? 我可以在github页面站点中提供一个javascript文件而不是index.html吗? - Can I serve a javascript file instead of index.html in my github pages site? 我通过运行 npm 运行构建构建了我的 Vuejs 应用程序,打开 index.html 引发错误:加载资源失败:net::ERR_FILE_NOT_FOUND - I built my Vuejs app by running npm run build, opening index.html throws errors: Failed to load resource: net::ERR_FILE_NOT_FOUND 每当我在 react 上运行 npm start 时,它都会出错。 下图 - whenever i run npm start on my react it gives an error. Image below 使用 API 中的 HTML 而不是 index.html 中的静态 HTML 来为我的 React 应用程序补充水分 - Hydrate my React app with HTML from the API instead of static HTML from index.html 如何使用 JavaScript 在我的 index.html 文件中嵌入 API 调用? - How do I embed an API call in my index.html file using JavaScript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM