0

I'm using:

Windows 10
npm -v 5.8.0
npx -v 9.7.1

When running npx, I'm getting: "The "path" argument must be of type string".

I am trying to create a React app. Get this error:

λ npx create-react-app myapp
npx: installed 1 in 4.576s

The "path" argument must be of type string
C:\Users\MyUser\AppData\Roaming\npm\node_modules\create-react-app\index.js
C:\Users\MyUser\AppData\Roaming\npm\node_modules\create-react-app\package.json: Unexpected string in JSON at position 52
R.F. Nelson
  • 2,254
  • 2
  • 12
  • 24
Алекс
  • 25
  • 1
  • 8

3 Answers3

3

Before running

npx create-react-app

you need to install create-react-app globally on your machine using

npm install -g create-react-app

When this is successful, you can proceed to run the npx code as below

npx create-react-app app-name

Lekens
  • 1,823
  • 17
  • 31
0

This line in the error is important:

C:\Users\MyUser\AppData\Roaming\npm\node_modules\create-react-app\package.json: Unexpected string in JSON at position 52

That means that your package.json file is not formatted correctly.

There are tools online such as this which can help ensure that the formatting of your package.json is correct.

R.F. Nelson
  • 2,254
  • 2
  • 12
  • 24
  • I had installed npm i create-react-app. I not do any changed in "package.json". Wthich trubles can accure ? Below package.json: – Алекс May 26 '18 at 22:34
  • { "_from": "create-react-app", "_id": "create-react-app@1.5.2", "_inBundle": false, "_integrity": "sha512-vnYIzsfTaqai2l07P9qtxhsZgHbzirC2omxKmf16wqvpXao9CNCDmpk+BCZRElih7HTn/mpO3soe8DTZV4DsgQ==", "_location": "/create-react-app", "_phantomChildren": {}, "_requested": { "type": "tag", "registry": true, "raw": "create-react-app", "name": "create-react-app", "escapedName": "create-react-app", "rawSpec": "", "saveSpec": null, "fetchSpec": "latest" }, – Алекс May 26 '18 at 22:35
  • well, line 52 ], – Алекс May 26 '18 at 22:36
  • }, "files": [ "index.js", "createReactApp.js" ], "homepage": "https://github.com/facebookincubator/create-react-app#readme", "keywords": [ "react" ], – Алекс May 26 '18 at 22:36
  • is it non working module "create-react-app" ? or I do some stupid mistake ? – Алекс May 26 '18 at 22:38
  • thx for yr advise https://jsonlint.com/, I used one to check package.json. Results "Valid JSON" – Алекс May 26 '18 at 22:42
0

resolved. Exist no one npx. U must call npx with full path:

C:\Users\MyUser\AppData\Roaming\npm\npx.cmd create-react-app MyApp

Алекс
  • 25
  • 1
  • 8