简体   繁体   中英

How to fix problem with start Nx react+express

[webpack-dev-server] [HPM] Error occurred while proxying request localhost:4200/api to http://localhost:3333/ [ECONNREFUSED] ( https://nodejs.org/api/errors.html#errors_common_system_errors )

I create nx app with react and express and when I tried to start app I had this problem

在此处输入图像描述

npm run start is only running the react app, so in order to use both (react+express), if nx is not installed globally, add the line

  "scripts": {
    "start": "nx serve",
    "start-api": "nx serve api",
    "build": "nx build",
    "test": "nx test"
  },

just bellow "start": "nx serve", and run two consoles, in one you can run

npm run start

and in the other

npm run start-api

that way you will have both modules running and the error will disappear

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM