【问题标题】:Latest npm cra install bug最新的 npm cra 安装错误
【发布时间】:2020-03-27 12:45:35
【问题描述】:

刚刚更新到 npm 6.14.4,当我尝试使用 cra-template 创建新应用时,会出现此错误。我该如何解决这个问题?

npx create-react-app sphinx.ui.react

错误日志

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 ]

【问题讨论】:

  • 你的问题是什么?我会假设所涉及的任何包都发布了无效的 JSON
  • 我该如何解决这个问题?

标签: javascript node.js json npm


【解决方案1】:

尝试卸载该版本,然后重新安装所需的版本,我遇到了 discord.js 的问题 - 在我这样做后它工作了

【讨论】:

    【解决方案2】:

    我不小心更改了我的注册表。这是我的错xD。改回默认修复它

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

    【讨论】:

      猜你喜欢
      • 2020-12-04
      • 2016-10-13
      • 2023-03-30
      • 2015-04-18
      • 2012-02-09
      • 2022-01-10
      • 2016-04-03
      • 1970-01-01
      相关资源
      最近更新 更多