无法使用XAMPP部署React项目 [英] Unable to deploy React project using XAMPP
问题描述
如何构建我的项目,以便可以将其放置在我想要的任何地方?例如,如果可能的话,我很想看到它, XAMPP ?
每当我构建我的React应用程序时, index.html 为空.
这是GitHub上的整个项目:
package.json
{"name":"my_react","version":"0.1.0",私人":是的,依赖关系":{"@ stardust-ui/docs-components":"^ 0.40.0","@ testing-library/jest-dom":"^ 4.2.4","@ testing-library/react":"^ 9.5.0","@ testing-library/user-event":"^ 7.2.1","bootstrap":"^ 4.5.0","browser-sync":"^ 2.26.7","del":"^ 5.1.0",表达":"^ 4.17.1","express-favicon":"^ 2.0.1","gulp-autoprefixer":"^ 7.0.1","gulp-concat":"^ 2.6.1","gulp-copy":"^ 4.0.1","gulp-data":"^ 1.3.1","gulp-plumber":"^ 1.2.1","gulp-sourcemaps":"^ 2.6.5","gulp-twig":"^ 1.2.0",更漂亮":"^ 1.4.2","react":"^ 16.13.1","react-dom":"^ 16.13.1","react-router":"^ 5.2.0","react-router-dom":"^ 5.2.0",反应脚本":"3.4.1","react-sidebar":"^ 3.0.2"},脚本":{"start":反应脚本开始","build":"react-scripts build","test":反应脚本测试","eject":反应脚本弹出"},"eslintConfig":{"extends":"react-app"},浏览器列表":{生产": [> 0.2%",没死",不是全部op_mini"],发展": [最后1个chrome版本",最新的1个Firefox版本",最后1个野生动物园版本"]},"description":该项目已由[Create React App](https://github.com/facebook/create-react-app)引导.","main":"index.js","devDependencies":{"@ craco/craco":"^ 5.6.4","@ semantic-ui-react/craco-less":"^ 1.2.1","gulp":"^ 4.0.2","gulp-sass":"^ 4.1.0","node-sass":"^ 4.14.1","semantic-ui-less":"^ 2.4.1"},"author":"slabys",许可证":"ISC",存储库":{"type":"git","url":反应"},"optionalDependencies":{}}
问题已解决!
一切正常.当我在 XAMPP htdocs 中有这个项目 build
时,我将其放入文件夹中.因此,直接从本地主机下的文件夹移动文件后,一切都开始工作.
How can I build my project so I can put it wherever I want? For example, I would love to see it on, if it's possible, XAMPP?
Whenever I build my react app, index.html is empty.
Here is the whole project on GitHub: https://github.com/slabys/reacty.git
Whenever I use npm run build
, my folder build is created with all the content:
index.html from build: https://pastebin.com/WSyAvrwu
package.json
{
"name": "my_react",
"version": "0.1.0",
"private": true,
"dependencies": {
"@stardust-ui/docs-components": "^0.40.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"bootstrap": "^4.5.0",
"browser-sync": "^2.26.7",
"del": "^5.1.0",
"express": "^4.17.1",
"express-favicon": "^2.0.1",
"gulp-autoprefixer": "^7.0.1",
"gulp-concat": "^2.6.1",
"gulp-copy": "^4.0.1",
"gulp-data": "^1.3.1",
"gulp-plumber": "^1.2.1",
"gulp-sourcemaps": "^2.6.5",
"gulp-twig": "^1.2.0",
"prettier": "^1.4.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-sidebar": "^3.0.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
"main": "index.js",
"devDependencies": {
"@craco/craco": "^5.6.4",
"@semantic-ui-react/craco-less": "^1.2.1",
"gulp": "^4.0.2",
"gulp-sass": "^4.1.0",
"node-sass": "^4.14.1",
"semantic-ui-less": "^2.4.1"
},
"author": "slabys",
"license": "ISC",
"repository": {
"type": "git",
"url": "react"
},
"optionalDependencies": {}
}
Problem solved!
All works fine. Just when I have this projects build
in XAMPP htdocs, I put in into a folder. So after moving files from folder directly under localhost EVERYTHING started to work.
这篇关于无法使用XAMPP部署React项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!