Reactjs 我能';是否使用npx create react应用程序安装react?
我正在尝试使用npx create react应用程序,但出现如下错误:Reactjs 我能';是否使用npx create react应用程序安装react?,reactjs,npm,create-react-app,npx,Reactjs,Npm,Create React App,Npx,我正在尝试使用npx create react应用程序,但出现如下错误: npm错误!在分析附近区域时Json输入意外结束 “…eact app/-/create rea” npm错误!此运行的完整日志可在以下位置找到:npm ERR! C:\Users\dp\AppData\Roaming\npm cache\\u logs\2018-12-06T18-42-56-293Z-debug.log 安装以创建响应-app@latest失败,代码为1** 错误的日志文件在这里 我怎样才能摆脱这个麻
npm错误!在分析附近区域时Json输入意外结束
“…eact app/-/create rea”
npm错误!此运行的完整日志可在以下位置找到:npm ERR!
C:\Users\dp\AppData\Roaming\npm cache\\u logs\2018-12-06T18-42-56-293Z-debug.log
安装以创建响应-app@latest失败,代码为1**
错误的日志文件在这里
我怎样才能摆脱这个麻烦
0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli
'C:\\Users\\dp\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'create-react-app@latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli
'C:\\Users\\dp\\AppData\\Roaming\\npm-cache\\_npx\\3588',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json' ]
2 info using npm@6.4.1
3 info using node@v10.13.0
4 verbose npm-session 7862701600d4f4ce
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304
https://registry.npmjs.org/create-react-app 872ms (from cache)
8 silly fetchPackageMetaData error for create-react-app@latest
Unexpected end of JSON input while parsing near
'...eact-app/-/create-rea'
9 timing stage:rollbackFailedOptional Completed in 4ms 10 timing
stage:runTopLevelLifecycles Completed in 1693ms 11 verbose stack
SyntaxError: Unexpected end of JSON input while parsing near
'...eact-app/-/create-rea' 11 verbose stack at JSON.parse
(<anonymous>) 11 verbose stack at parseJson
(C:\Users\dp\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
11 verbose stack at consumeBody.call.then.buffer
(C:\Users\dp\AppData\Roaming\npm\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
11 verbose stack at process._tickCallback
(internal/process/next_tick.js:68:7) 12 verbose cwd C:\Users\dp 13
verbose Windows_NT 6.3.9600 14 verbose argv "C:\\Program
Files\\nodejs\\node.exe"
"C:\\Users\\dp\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js"
"install" "create-react-app@latest" "--global" "--prefix"
"C:\\Users\\dp\\AppData\\Roaming\\npm-cache\\_npx\\3588" "--loglevel"
"error" "--json" 15 verbose node v10.13.0 16 verbose npm v6.4.1 17
error Unexpected end of JSON input while parsing near
'...eact-app/-/create-rea' 18 verbose exit [ 1, true ]
0信息如果它以ok 1 verbose cli['C:\\Program Files\\nodejs\\node.exe'结尾,它就起作用了,
1详细cli
'C:\\Users\\dp\\AppData\\Roaming\\npm\\node\u modules\\npm\\bin\\npm cli.js',
1详细cli“安装”,
1详细cli“创建响应”-app@latest',
1详细cli'--全局',
1详细cli'--前缀',
1详细cli
'C:\\Users\\dp\\AppData\\Roaming\\npm cache\\\u npx\\3588',
1详细cli'--loglevel',
1详细cli“错误”,
1详细cli'--json']
2信息使用npm@6.4.1
3信息使用node@v10.13.0
4详细的npm会话7862701600d4f4ce
5.安装loadCurrentTree
6.安装readGlobalPackageData
7 http获取304
https://registry.npmjs.org/create-react-app 872ms(来自缓存)
8 create react的数据包元数据错误-app@latest
在分析附近区域时JSON输入意外结束
“…eact app/-/create rea”
9定时阶段:在4ms 10定时内完成回滚可选
阶段:在1693ms 11详细堆栈中完成runTopLevelLifecycles
SyntaxError:在解析附近对象时JSON输入意外结束
“…eact app/-/create rea”11 JSON.parse处的详细堆栈
()11 parseJson处的详细堆栈
(C:\Users\dp\AppData\Roaming\npm\node\u modules\npm\node\u modules\json parse better errors\index.js:7:17)
11 consumerbody.call.then.buffer处的详细堆栈
(C:\Users\dp\AppData\Roaming\npm\node\u modules\npm\node\u modules\node fetch npm\src\body.js:96:50)
11进程上的详细堆栈。\u
(internal/process/next_tick.js:68:7)12详细的cwd C:\Users\dp 13
详细Windows\u NT 6.3.9600 14详细argv“C:\\Program
文件\\nodejs\\node.exe“
“C:\\Users\\dp\\AppData\\Roaming\\npm\\node\u modules\\npm\\bin\\npm cli.js”
“安装”“创建”“响应”-app@latest“--global”“--前缀”
“C:\\Users\\dp\\AppData\\Roaming\\npm缓存\\\U npx\\3588”“--日志级别”
“错误”“--json”15详细节点v10.13.0 16详细npm v6.4.1 17
在分析附近区域时,JSON输入意外结束时出错
“…eact app/-/create rea”18详细退出[1,true]
当我使用官方来源的命令时,我在创建react项目时遇到了同样的问题
以上命令在我的windows上不起作用。
即使在那时,我的机器上也有节点>=6和npm>=5.2
无法打开localhost:3000
然后我用这个命令
npm install -g create-react-app
create-react-app my-app-name
cd my-app-name
npm start
它工作得非常好。
我从学到了要解决这个问题,请按顺序运行这些命令
npm init
npm安装创建反应应用程序
npx创建反应应用程序myapp
清除npm缓存:
npm cache clean --force
然后再试一次
npm init
然后npx创建反应应用程序myapp
以管理员身份运行Windows PowerShell并键入以下内容:
Set ExecutionPolicy-ExecutionPolicy RemoteSigned
我也遇到了同样的问题“为创建而安装”-app@latest失败,代码为“7”
用这个。这对我有用
npm install -g create-react-app
npx create-react-app my-app
cd my-app
npm start
npm cache clear --force
npm init -y
npx create-react-app my-app
有关更多参考信息,请转到:如果无法创建应用程序,请尝试以32位重新安装nodeJS,然后重试。首先,在终端中键入以下内容以清除缓存:
npm cache clean --force
然后通过以下步骤或类型升级您的npm版本:
npm install -g npm@next
现在转到Windows设置的程序和功能中的“NodeJS”,并修复安装
重新启动终端并键入:
npx create-react-app my-app
这将有望解决您的问题
npm uninstall -g create-react-app
npx create-react-app my-app
您不需要全局安装create react应用程序包。”“npx”已使用最新版本安装
- 有时您可能会看到一些防病毒软件请求将其添加到 白名单或将其添加到阻止列表中,您应该停止或 添加白名单
有时这是因为网速太慢。 试试这个
npx create-react-app <app name> -timeout=60000
npx创建反应应用程序-超时=60000
默认超时=30000(30秒)。如果有必要,请增加超时时间。我尝试了所有方法,但均无效 然后我重新启动了我的笔记本电脑,当我尝试
npm init
然后尝试npm install create react app
时,我收到了一个最新的潜在有害文件警报,但它没有问题,我确认了它。
创建反应应用程序的尝试失败了,但当我再次尝试时,成功了
有可能是防火墙之类的东西阻止了节点执行某个函数,因此它会抛出一个callback()never called error。这个问题是由很多原因造成的
- 如果安装react应用程序所需的某个节点模块丢失,则会发生这种情况
- 另一个原因是您的网络连接不稳定
- 有时,但在极少数情况下,防病毒软件可能会认为缓存中的cmd文件是恶意软件
npm cache clean --force
npx create-react-app my-app
npm cache clear --force
npm init -y
npx create-react-app my-app
> npm config set cache "C:\Users\mycomputer~1name\AppData\Roaming\npm-cache" --global
npx create-react-app <app name> -timeout=60000
npm cache clean --force
npx create-react-app myapp