简体   繁体   中英

Latest npm cra install bug

Just updated to npm 6.14.4 and when I try to create a new app with cra-template this error shows up. How do I fix this?

npx create-react-app sphinx.ui.react

Error Log

50 timing stage:runTopLevelLifecycles Completed in 5234ms
51 verbose stack SyntaxError: Unexpected token : in JSON at position 18277 while parsing near '...true,"daizch":true}}:true,"akabeko":true...'
51 verbose stack     at JSON.parse (<anonymous>)
51 verbose stack     at parseJson (C:\Users\Altanbagana\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
51 verbose stack     at C:\Users\Altanbagana\AppData\Roaming\npm\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
51 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
52 verbose cwd C:\Users\Altanbagana\Documents\Programming\Web Projects
53 verbose Windows_NT 10.0.18363
54 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Altanbagana\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "create-react-app@latest" "--global" "--prefix" "C:\\Users\\Altanbagana\\AppData\\Roaming\\npm-cache\\_npx\\5552" "--loglevel" "error" "--json"
55 verbose node v12.16.1
56 verbose npm  v6.14.4
57 error Unexpected token : in JSON at position 18277 while parsing near '...true,"daizch":true}}:true,"akabeko":true...'
58 verbose exit [ 1, true ]

尝试卸载该版本,然后重新安装所需的版本,我在使用 discord.js 时遇到了这个问题 - 在我执行此操作后它起作用了

I accidentally changed my registry. It was my fault xD. Changing back to default fixed it

npm config set registry https://registry.npmjs.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM