小编HK *_* S0的帖子

Vue 项目中 TypeScript“找不到模块...”

我在 Vue 项目中使用 TypeScript。

但是当我尝试导入 vue 文件时,由于出现“找不到模块...”错误,我无法获取 .vue 文件。

在此输入图像描述

奇怪的是,intellisense 仅显示 .vue 文件正上方的目录。

Intellisense 很好地显示了目录 Intellisense 很好地显示了目录

但它不显示其中的 .vue 文件 但它不显示其中的 .vue 文件

我的根目录中还有 vue-shim.d.ts 文件。

import typescript vue.js visual-studio-code vuejs2

15
推荐指数
2
解决办法
2万
查看次数

ESLint“文件扩展名 (.vue) 是非标准”错误

eslint --ext \".js,.ts,.vue\" --ignore-path .gitignore .使用 运行脚本时npm run lint,出现以下错误。

/(somethingSomething...)/Test.vue
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: components/Test.vue.
The extension for the file (.vue) is non-standard. You should add "parserOptions.extraFileExtensions" to your config
Run Code Online (Sandbox Code Playgroud)

我正在使用vue-eslint-parsereslint-plugin-vue作为 devDependency。并.eslintrc.js包含

...
extends: [
...
    'plugin:vue/recommended',
    "eslint:recommended"
  ],
  parser: "vue-eslint-parser",
  parserOptions: {
    parser: "@typescript-eslint/parser",
    project: './tsconfig.eslint.json'
  },
  plugins: [
    'html',
    'vue',
    'jest'
  ],
...
Run Code Online (Sandbox Code Playgroud)

如手册中所述。并且tsconfig.eslint.json …

eslint tsconfig vue.js eslint-plugin-vue

7
推荐指数
0
解决办法
3136
查看次数

npm 安装错误。'npm 错误!吉普 错误!找到Python,堆栈错误'

每当我尝试运行npm installnpm update在我的 nuxt.js(vue.js) 项目中时,都会出现以下错误。

npm ERR! code 1
npm ERR! path /Users/kyeolhan/ForWork/BackOffceFront/node_modules/deasync
npm ERR! command failed
npm ERR! command sh -c node ./build.js
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@16.14.2 | darwin | arm64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp …
Run Code Online (Sandbox Code Playgroud)

python node.js npm npm-install nuxt.js

6
推荐指数
1
解决办法
4万
查看次数