Skip to content

taro-ui-vue/vuex模板初始化失败,生成的package.json文件格式错误,且无法满足eslint版本依赖 #93

@maoxuner

Description

@maoxuner

软件版本

$ uname -a
Linux ideabook 6.1.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 24 Jan 2023 21:07:04 +0000 x86_64 GNU/Linux
$ node -v
v18.13.0
$ npm -v
8.19.3
$ npx @tarojs/cli                 
👽 Taro v3.5.11

复现操作

$ npx @tarojs/cli init taro-ui-vue # Vue,TS否,Sass,Webpack5,npm,Gitee,taro-ui-vue

部分日志如下,生成的package.json文件,eslint后多一个,造成json解析失败

✔ cd taro-ui-vue, 执行 git init
⚠ npm
⚠  ERR! code EJSONPARSE
npm ERR! path /tmp/taro-ui-vue/package.json
⚠ npm 
⚠ ERR! JSON.parse
⚠  Unexpected token "," (0x2C) in JSON at position 2107 while parsing near "...\"eslint\": \"^8.12.0\",,\n    \"css-loader\": ..."
npm ERR! JSON.parse Failed to parse JSON data.
⚠ npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.
⚠ 执行安装项目依赖 npm install, 需要一会儿...
⚠ npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nono/.npm/_logs/2023-01-29T06_47_48_179Z-debug-0.log
✖ 安装项目依赖失败,请自行重新安装!
Error: Command failed: npm install
npm ERR! code EJSONPARSE
npm ERR! path /tmp/taro-ui-vue/package.json
npm ERR! JSON.parse Unexpected token "," (0x2C) in JSON at position 2107 while parsing near "...\"eslint\": \"^8.12.0\",,\n    \"css-loader\": ..."
npm ERR! JSON.parse Failed to parse JSON data.
npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nono/.npm/_logs/2023-01-29T06_47_48_179Z-debug-0.log

    at ChildProcess.exithandler (node:child_process:419:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'npm install'
}

手动修复package.json文件格式,去除多余的,,依然不满足eslint版本要求

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^8.12.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^5.0.0 || ^6.0.0" from [email protected]
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   dev eslint-plugin-vue@"^6.x" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/nono/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nono/.npm/_logs/2023-01-29T06_59_52_849Z-debug-0.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions