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
3
  • Can you show us what your package.json file looks like? Commented May 26, 2018 at 13:14
  • I had installed npm i create-react-app Commented May 26, 2018 at 22:32
  • Try newer version of node.js/npm, I had similar issue when switched to older node.js version. Commented Jan 25, 2021 at 12:04

3 Answers 3

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

Sign up to request clarification or add additional context in comments.

1 Comment

Can you please explain your answer? Code-only answers can often be difficult to interpret.
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.

6 Comments

I had installed npm i create-react-app. I not do any changed in "package.json". Wthich trubles can accure ? Below package.json:
{ "_from": "create-react-app", "_id": "[email protected]", "_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" },
well, line 52 ],
}, "files": [ "index.js", "createReactApp.js" ], "homepage": "github.com/facebookincubator/create-react-app#readme", "keywords": [ "react" ],
is it non working module "create-react-app" ? or I do some stupid mistake ?
|
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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.