eslint --init报错?

环境:

  • ESLint Version: v6.0.1
  • Node Version: v10.16.0
  • npm Version: 6.9.0

问题描述:

使用eslint --init,步骤到安装依赖的时候报错,提示找不到package.json。求解决方法

clipboard.png

图上使用的eslint是本地开发依赖,全局安装eslint报同样的错误。

日志:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'i',
1 verbose cli   '--save-dev',
1 verbose cli   'eslint-plugin-vue@latest',
1 verbose cli   'eslint-config-plugin:vue/essential,standard@latest' ]
2 info using npm@6.9.0
3 info using node@v10.16.0
4 verbose npm-session 15f24d7e0071831e
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for file:eslint-config-plugin:vue\essential,standard@latest Could not install from "eslint-config-plugin:vue\essential,standard@latest" as it does not contain a package.json file.
8 http fetch GET 304 https://registry.npm.taobao.org/eslint-plugin-vue 354ms (from cache)
9 silly pacote tag manifest for eslint-plugin-vue@latest fetched in 365ms
10 timing stage:rollbackFailedOptional Completed in 0ms
11 timing stage:runTopLevelLifecycles Completed in 2638ms
12 verbose stack Error: ENOENT: no such file or directory, open 'D:\self\webpack\vue-template\eslint-config-plugin:vue\essential,standard@latest\package.json'
13 verbose cwd D:\self\webpack\vue-template
14 verbose Windows_NT 10.0.18362
15 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "--save-dev" "eslint-plugin-vue@latest" "eslint-config-plugin:vue/essential,standard@latest"
16 verbose node v10.16.0
17 verbose npm  v6.9.0
18 error code ENOLOCAL
19 error Could not install from "eslint-config-plugin:vue\essential,standard@latest" as it does not contain a package.json file.
20 verbose exit [ 1, true ]
阅读 6k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏