Describe the bug
npx create-react-app myapp fails with the following error:
undefined:1
<html>
^
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at IncomingMessage.<anonymous> (C:\projects\react\TestApp5\node_modules\create-react-app\createReactApp.js:1107:28)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Environment
npx create-react-app --info
Environment Info:
current version of create-react-app: 5.0.1
running from C:\projects\react\TestApp5\node_modules\create-react-app
System:
OS: Windows 10 10.0.19044
CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz
Binaries:
Node: 16.17.0 - C:\tools\nvm\symlink\node.EXE
Yarn: 1.22.19 - C:\projects\react\TestApp5\node_modules\.bin\yarn.CMD
npm: 8.19.2 - C:\tools\nvm\symlink\npm.CMD
Browsers:
Chrome: Not Found
Edge: Spartan (44.19041.1266.0), Chromium (106.0.1370.52)
Internet Explorer: 11.0.19041.1566
npmPackages:
react: ^18.2.0 => 18.2.0
react-dom: ^18.2.0 => 18.2.0
react-scripts: ^5.0.1 => 5.0.1
npmGlobalPackages:
create-react-app: Not Found
I am behind a corporate proxy.
Steps to reproduce
- run
npx create-react-app myapp
I've also tried various debugging suggestions, such as
npm init
npm install create-react-app (as well as create-react-app@latest)
npm install react-scripts
npx create-react-app@latest myapp
Also tried npm cache clean -f and starting fresh with a new package.
Expected behavior
Creates a react app.
Actual behavior
Fails immediately with the error above. Running alternative npm init react-app myapp produces a similar error with a bit more info:
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at IncomingMessage.<anonymous> (C:\projects\react\TestApp5\node_modules\create-react-app\createReactApp.js:1107:28)
at IncomingMessage.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! code 1
npm ERR! path C:\projects\react\TestApp5
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c create-react-app my-app
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\npschoo\AppData\Local\npm-cache\_logs\2022-10-25T18_22_31_599Z-debug-0.log
Here's the contents of the log file:
0 verbose cli C:\tools\nvm\symlink\node.exe C:\tools\nvm\symlink\node_modules\npm\bin\npm-cli.js
1 info using npm@8.19.2
2 info using node@v16.17.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:C:\tools\nvm\v16.17.0\node_modules\npm\npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:C:\projects\react\TestApp5\.npmrc Completed in 0ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:C:\Users\npschoo\.npmrc Completed in 2ms
12 timing config:load:user Completed in 2ms
13 timing config:load:file:C:\tools\nvm\symlink\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 10ms
19 timing npm:load:configload Completed in 10ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 1ms
22 verbose title npm init react-app my-app
23 verbose argv "init" "react-app" "my-app"
24 timing npm:load:setTitle Completed in 2ms
25 timing config:load:flatten Completed in 2ms
26 timing npm:load:display Completed in 3ms
27 verbose logfile logs-max:10 dir:C:\Users\npschoo\AppData\Local\npm-cache\_logs
28 verbose logfile C:\Users\npschoo\AppData\Local\npm-cache\_logs\2022-10-25T18_22_31_599Z-debug-0.log
29 timing npm:load:logFile Completed in 7ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 26ms
33 silly logfile start cleaning logs, removing 2 files
34 silly logfile error removing log file C:/Users/npschoo/AppData/Local/npm-cache/_logs/2022-10-25T15_35_31_259Z-debug-0.log [Error: EPERM: operation not permitted, unlink 'C:\Users\npschoo\AppData\Local\npm-cache\_logs\2022-10-25T15_35_31_259Z-debug-0.log'] {
34 silly logfile errno: -4048,
34 silly logfile code: 'EPERM',
34 silly logfile syscall: 'unlink',
34 silly logfile path: 'C:\\Users\\npschoo\\AppData\\Local\\npm-cache\\_logs\\2022-10-25T15_35_31_259Z-debug-0.log'
34 silly logfile }
35 silly logfile done cleaning log files
36 timing command:init Completed in 390ms
37 verbose stack Error: command failed
37 verbose stack at ChildProcess.<anonymous> (C:\tools\nvm\v16.17.0\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:63:27)
37 verbose stack at ChildProcess.emit (node:events:513:28)
37 verbose stack at maybeClose (node:internal/child_process:1093:16)
37 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
38 verbose pkgid testapp5@1.0.0
39 verbose cwd C:\projects\react\TestApp5
40 verbose Windows_NT 10.0.19044
41 verbose node v16.17.0
42 verbose npm v8.19.2
43 error code 1
44 error path C:\projects\react\TestApp5
45 error command failed
46 error command C:\WINDOWS\system32\cmd.exe /d /s /c create-react-app my-app
47 verbose exit 1
48 timing npm Completed in 517ms
49 verbose code 1
50 error A complete log of this run can be found in:
50 error C:\Users\npschoo\AppData\Local\npm-cache\_logs\2022-10-25T18_22_31_599Z-debug-0.log
Describe the bug
npx create-react-app myappfails with the following error:Environment
npx create-react-app --infoI am behind a corporate proxy.
Steps to reproduce
npx create-react-app myappI've also tried various debugging suggestions, such as
npm initnpm install create-react-app(as well ascreate-react-app@latest)npm install react-scriptsnpx create-react-app@latest myappAlso tried
npm cache clean -fand starting fresh with a new package.Expected behavior
Creates a react app.
Actual behavior
Fails immediately with the error above. Running alternative
npm init react-app myappproduces a similar error with a bit more info:Here's the contents of the log file: