Алекс
Алекс

Reputation: 17

npx create-react-app get error

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

Upvotes: 0

Views: 2780

Answers (3)

Lekens
Lekens

Reputation: 1967

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

Upvotes: 3

Алекс
Алекс

Reputation: 17

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

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

Upvotes: 0

R.F. Nelson
R.F. Nelson

Reputation: 2312

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.

Upvotes: 0

Related Questions