1

I've got NODE (current version: 18.9.0) installed in my computer and trying to create a react app, but always fails.

npx create-react-app my-app-one

The error I'm getting:

C:\Users\MyName\Documents\React>npx create-react-app my-app-one
Need to install the following packages:
  create-react-app@5.0.1
Ok to proceed? (y) y
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

Creating a new React app in C:\Users\MyName\Documents\React\my-app-one.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


Aborting installation.
Unexpected error. Please report it as a bug:
Error: spawn UNKNOWN
    at ChildProcess.spawn (node:internal/child_process:413:11)
    at Object.spawn (node:child_process:743:9)
    at spawn (C:\Users\MyName\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\cross-spawn\index.js:12:24)
    at C:\Users\MyName\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:383:19
    at new Promise (<anonymous>)
    at install (C:\Users\MyName\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:334:10)
    at C:\Users\MyName\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:461:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'spawn'
}

Deleting generated file... package.json
Deleting my-app-one/ from C:\Users\MyName\Documents\React
Done.
npm notice
npm notice New patch version of npm available! 8.19.1 -> 8.19.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.19.2
npm notice Run npm install -g npm@8.19.2 to update!
npm notice

Then looking at warnings etc I've done below

npm i tar                    <- This is to fix warning deprecated tar@2.2.2
npm install -g npm@8.19.2    <- To update npm minor version

Still when I'm trying to create a react app I'm getting following error.

  • I ran command prompt Administrator mode.
  • Changed location to D drive and tried.
  • Un-installed and re-installed Node few times and restarting the machine as well.

If someone has experienced this and know the solution would like to hear. Thanks!

C:\Users\MyName\Documents\React>npx create-react-app app-xyz

Creating a new React app in C:\Users\MyName\Documents\React\app-xyz.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


Aborting installation.
  npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... package.json
Deleting app-xyz/ from C:\Users\MyName\Documents\React
node:fs:1225
  return handleErrorFromBinding(ctx);
         ^

Error: EBUSY: resource busy or locked, rmdir '\\?\C:\Users\MyName\Documents\React\app-xyz'
    at rmdirSync (node:fs:1225:10)
    at _rmdirSync (node:internal/fs/rimraf:235:5)
    at rimrafSync (node:internal/fs/rimraf:193:7)
    at Object.rmSync (node:fs:1274:10)
    at Object.removeSync (C:\Users\MyName\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\fs-extra\lib\remove\index.js:15:28)
    at C:\Users\MyName\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:539:14
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -4082,
  syscall: 'rmdir',
  code: 'EBUSY',
  path: '\\\\?\\C:\\Users\\MyName\\Documents\\React\\app-xyz'
}

Node.js v18.9.0

EDITS

Also installed YARN and tried following.

npm install -g yarn
yarn global add create-react-app
yarn create react-app my-app

Still the same error:

C:\Users\MyName\Desktop\Apps>yarn create react-app my-app
yarn create v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "create-react-app@5.0.1" with binaries:
      - create-react-app

Creating a new React app in C:\Users\MyName\Desktop\Apps\my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template --cwd C:\Users\MyName\Desktop\Apps\my-app has failed.

Deleting generated file... package.json
Deleting my-app/ from C:\Users\MyName\Desktop\Apps
Done.
error Command failed.
Exit code: 1
Command: C:\Users\MyName\AppData\Local\Yarn\bin\create-react-app
Arguments: my-app
Directory: C:\Users\MyName\Desktop\Apps
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
Janz
  • 11
  • 2
  • https://stackoverflow.com/questions/68857411/npm-warn-deprecated-tar2-2-2-this-version-of-tar-is-no-longer-supported-and-w – Andy Sep 21 '22 at 15:25
  • HI Andy, this is where I saw "npm i tar" and updated mine. Also I havent installed create-react-app globally and was trying to use npx (React recomemded way). Tried Yarn as well. Looks like both fails on "npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.". Thanks! – Janz Sep 21 '22 at 15:36
  • When you uninstall node do you ensure that all the related node/npm folders are gone before reinstalling node? Everything in your appdata/roaming and appdata/local folders, for example? – Andy Sep 21 '22 at 15:51
  • Hi Andy, yes I've followed the steps in this link to make sure haven't missed any. https://stackoverflow.com/questions/20711240/how-to-completely-remove-node-js-from-windows .... First I installed node long term support version and because it didn't work then the current latest. Thanks. – Janz Sep 21 '22 at 15:57

1 Answers1

0

i recomend you to install create-react-app as global with command npm create-react-app -g, after that you can run `npx create-react-app [file name], if fail just

aknadif
  • 71
  • 3