我使用的是:
Windows 10
npm -v 5.8.0
npx -v 9.7.1在运行npx时,我得到:"The "path" argument must be of type string"。
我正在尝试创建一个React应用程序。获取此错误:
λ 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发布于 2018-05-26 21:13:01
错误中的这一行很重要:
位置52的JSON中的
C:\Users\MyUser\AppData\Roaming\npm\node_modules\create-react-app\package.json:意外字符串
这意味着您的package.json文件的格式不正确。
有一些在线工具,如this,可以帮助确保package.json的格式正确。
发布于 2018-05-27 07:55:18
已解决。不存在任何npx。必须使用完整路径调用npx:
C:\Users\MyUser\AppData\Roaming\npm\npx.cmd create-react-app MyApp
发布于 2019-08-26 18:51:54
在运行之前
npx创建-反应-应用
您需要使用以下命令在您的计算机上全局安装create-react-app
npm安装-g create-react-app
成功后,您可以继续运行npx代码,如下所示
npx创建-反应-应用程序名称
https://stackoverflow.com/questions/50543105
复制相似问题