我有一个我已经工作了一个月的Create-react-app应用程序。
我现在在构建或运行时遇到错误:
npm run start
启动开发服务器......无法编译。
./ src / index.js模块构建失败:错误:找不到模块 './globals.json'
现在问题是我甚至不知道在哪里看。它没有告诉我哪个模块有问题。有没有办法打开详细的更多调试信息?
任何指导都将不胜感激。
我的package.json:
{
"name": "hbi.contractor",
"version": "0.1.0",
"private": true,
"homepage": "http://www.mysitecom.au/app",
"proxy": {
"/api/*": {
"target": "https://api.mysite.com.au",
"changeOrigin": true
}
},
"dependencies": {
"@fortawesome/fontawesome": "^1.1.8",
"axios": "^0.17.1",
"immutability-helper": "^2.7.0",
"inputmask": "^3.3.11",
"jquery": "^3.3.1",
"materialize-css": "^0.100.2",
"nodemon": "^1.17.4",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-dropzone": "^4.2.9",
"react-format-number": "^1.3.1",
"react-html-parser": "^2.0.2",
"react-ionicons": "^2.1.6",
"react-live-clock": "^2.0.3",
"react-load-script": "0.0.6",
"react-maskedinput": "^4.0.1",
"react-moment": "^0.7.0",
"react-owl-carousel": "^2.2.0",
"react-redirect": "^1.0.0",
"react-redux": "^5.0.7",
"react-router-dom": "^4.2.2",
"react-rxinput": "^1.0.4",
"react-scripts": "1.0.17",
"react-sticky": "^6.0.2",
"react-sticky-el": "^1.0.17",
"react-text-mask": "^5.4.1",
"redux": "^3.7.2",
"redux-form": "^6.8.0",
"redux-thunk": "^2.2.0",
"universal-cookie": "^2.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"react-input-mask": "^1.2.2",
"react-materialize": "^1.1.2",
"react-native-masked-text": "^1.6.5",
"react-number-format": "^3.3.4"
}
}
我的index.js(入口点)
import "jquery/dist/jquery.min.js";
import "materialize-css/dist/js/materialize.js";
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { createStore, applyMiddleware } from "redux";
import reduxThunk from "redux-thunk";
import App from "./components/App";
import reducers from "./reducers";
import "./index.css";
import queryString from "./utilities/querystring";
import "materialize-css/dist/css/materialize.min.css";
const electionId = queryString.getParameterByName("electionId");
const store = createStore(reducers, {election: electionId}, applyMiddleware(reduxThunk));
if (electionId){
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.querySelector("#root")
);
}
else{
ReactDOM.render(
<div>
Missing Vote Id
</div>,
document.querySelector("#root")
);
}
答案 0 :(得分:0)
我通过删除node_modules文件夹然后再次运行npm install来修复此问题