Skip to content

"Cannot find module '@vue/cli-service/...' from ..." when create project with remote preset that edited existing templates #5965

Open
@Leesson

Description

@Leesson

Version

4.5.7

Reproduction link

https://github.com/Leesson/vue-cli-preset-sim

Environment info

Environment Info:

  System:
    OS: macOS 10.15.7
    CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
  Binaries:
    Node: 10.12.0 - ~/.nvm/versions/node/v10.12.0/bin/node
    Yarn: Not Found
    npm: 6.14.5 - ~/.nvm/versions/node/v10.12.0/bin/npm
  Browsers:
    Chrome: 86.0.4240.80
    Edge: Not Found
    Firefox: Not Found
    Safari: 14.0
  npmPackages:
    @vue/cli-overlay:  4.5.7 
    @vue/cli-plugin-router:  4.5.7 
    @vue/cli-plugin-vuex:  4.5.7 
    @vue/cli-service: ^4.5.7 => 4.5.7 
    @vue/cli-shared-utils:  4.5.7 
    @vue/component-compiler-utils:  3.2.0 
    @vue/preload-webpack-plugin:  1.1.2 
    @vue/web-component-wrapper:  1.2.0 
    vue-hot-reload-api:  2.3.4 
    vue-loader:  15.9.3 (16.0.0-beta.8)
    vue-style-loader:  4.1.2 
    vue-template-es2015-compiler:  1.9.1 
  npmGlobalPackages:
    @vue/cli: 4.5.7

Steps to reproduce

create a project with this preset:

vue create --preset Leesson/vue-cli-preset-sim#main project-name

and then there will be an error "Error: Cannot find module '@vue/cli-service/generator/template/public/index.html' from '/private/var/folders/.../vue-cli-presets/vue-cli-preset-sim/generator/template/public'"

It seems the cli should install dependencies after clone the preset repo to local.
you can clone this repo to local, install it, and run the code below:

vue create --preset /path/to/repo project-name

then you can get the right result

What is expected?

create project

What is actually happening?

throw an error

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