Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: windows start:api:* scripts #1530

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

MikeMcC399
Copy link
Contributor

Issue

The script commands

  • yarn start:api
  • yarn start:api:watch
  • yarn dev

fail to run under Windows. The error message is:

'NODE_ENV' is not recognized as an internal or external command,

Changes

ORIGINAL

"start:api": "yarn tsnode --files backend/app.ts",
"start:api:watch": "nodemon --exec yarn tsnode --watch 'backend' backend/app.ts",

Breaking change in PR #1524

"start:api": "NODE_ENV=development yarn tsnode --files backend/app.ts",
"start:api:watch": "NODE_ENV=development nodemon --exec yarn tsnode --watch 'backend' backend/app.ts",

Verification

On Windows 11
Node.js 20.11.1

In a terminal window, execute

npm install yarn@latest -g
git clone https://github.com/cypress-io/cypress-realworld-app
cd cypress-realworld-app
yarn

then

yarn start:api

confirm no error, then kill the process (Ctrl C), and execute

yarn dev

Confirm that http://localhost:3001 backend server is started with log similar to the following:

$ yarn dev
yarn run v1.22.19
$ yarn db:seed:dev
$ yarn predev:cognito:ci
$ yarn copy:mock:awsexports && yarn copy:mock:awsexportses5
$ ncp scripts/mock-aws-exports.js src/aws-exports.js
$ ncp scripts/mock-aws-exports-es5.js aws-exports-es5.js
$ ncp ./data/database-seed.json ./data/database.json
$ cross-env NODE_ENV=development concurrently yarn:start:react yarn:start:api:watch
[start:react] $ vite
[start:api:watch] $ nodemon --exec yarn tsnode --watch 'backend' backend/app.ts
[start:api:watch] [nodemon] 2.0.22
[start:api:watch] [nodemon] to restart at any time, enter `rs`
[start:api:watch] [nodemon] watching path(s): 'backend'
[start:api:watch] [nodemon] watching extensions: ts,json
[start:api:watch] [nodemon] starting `yarn tsnode backend/app.ts`
[start:api:watch] $ nyc --silent ts-node -P tsconfig.tsnode.json backend/app.ts
[start:react]
[start:react]   VITE v4.4.2  ready in 826 ms
[start:react]
[start:react]   ➜  Local:   http://localhost:3000/
[start:react]   ➜  Network: use --host to expose
[start:api:watch] express-validator: sanitize(), sanitizeBody() and other sanitization-only middlewares have been deprecated.
[start:api:watch] Please use check(), body() and others instead, which must offer the same API, and more.
[start:api:watch] Backend server running at http://localhost:3001

@cypress-app-bot
Copy link

@MikeMcC399 MikeMcC399 marked this pull request as ready for review March 20, 2024 09:49
Copy link
Contributor

@AtofStryker AtofStryker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to pipe these through cross-env but I don't think the NODE_ENV is needed here any longer.

@AtofStryker AtofStryker merged commit fd9cf10 into cypress-io:develop Mar 21, 2024
10 checks passed
@MikeMcC399 MikeMcC399 deleted the windows-start-api branch March 21, 2024 19:13
markerikson pushed a commit to replayio-public/cypress-realworld-app that referenced this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RWA fails to start on Windows 11
3 participants