我必須爲應用程序創建前端。其他人使用節點創建後端。我一直使用create-react-app創建我的項目,但是,由於後端已經創建,包括模塊,路由,數據庫等,我不能使用這個命令來創建項目,所以我獨立安裝了所有的包。這是我的package.json:運行反應和節點
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build-css": "node-sass-chokidar client/ -o client/",
"watch-css": "npm run build-css && node-sass-chokidar client/ -o client/ --watch --recursive",
"start-js": "react-scripts start",
"build": "npm run build-css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"start": "npm-run-all -p start-node watch-css start-js",
"start-node": "node index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.16.2",
"body-parser": "^1.18.2",
"bulma": "^0.6.0",
"express": "^4.16.2",
"mongoose": "^4.12.3",
"morgan": "^1.9.0",
"q": "^1.4.1",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "^1.0.14"
},
"devDependencies": {
"node-sass-chokidar": "0.0.3",
"npm-run-all": "^4.1.1",
"sass": "^1.0.0-beta.2"
}
}
有與啓動JS,因爲節點已飛奔在端口3000和反應需要運行也有問題。我怎樣才能讓兩者同時運行?
[''併發'](https://www.npmjs.com/package/concurrently)?你讀過例如https://stackoverflow.com/questions/30950032/how-can-i-run-multiple-npm-scripts-in-parallel,或做過任何其他研究? – jonrsharpe
我做過研究,實際上發佈了答案,因爲我沒有發現任何能夠真正解決我的問題(或者我對此事理解正確)。我沒有看到你發給我的答案,但我很感激 – KeOt777