Skip to content

Cannot find module 'vue' in fresh Vue project with Typescript/ESLint #341

@RGamberini

Description

@RGamberini

When creating a Vue / Typescript / ESLint project with create-vue it will have a Cannot find module 'vue'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?ts(2792) in it by default.

Steps to Reproduce

  1. Start a create-vue project with the following settings:
$ npm create vue@latest

Vue.js - The Progressive JavaScript Framework

√ Project name: ... create-vue-test
√ Add TypeScript? ... Yes
√ Add JSX Support? ... No
√ Add Vue Router for Single Page Application development? ... No
√ Add Pinia for state management? ... No
√ Add Vitest for Unit Testing? ... No
√ Add an End-to-End Testing Solution? » No
√ Add ESLint for code quality? ... Yes
√ Add Prettier for code formatting? ... Yes
  1. Follow the installation steps.
  2. Following the readme.md enable Volar's takeover mode

Expected Behavior

An error free project.

Current Behavior

There will be an error in VS Code in the main.ts file.
image

Context (Environment)

Windows 10 19045

$ node --version
v18.13.0
$ npm --version
9.3.1

Possible Solution

Under these conditions compilerOptions.moduleResolution in tsconfig.app.json should be set to node by default.

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