Skip to content

use vue-cli with lerna and got Error: Cannot find module '@vue/cli-plugin-eslint' #4911

@jkhhuse

Description

@jkhhuse

Version

4.1.1

Reproduction link

https://github.com/jkhhuse/vue-cli-with-lerna

Environment info

lerna: v3.18.1
vue-cli: 4.1.1

Steps to reproduce

step1: lerna init and lerna.json config:

{
  "packages": [
    "packages/*"
  ],
  "npmClient": "yarn",
  "useWorkspaces": true,
  "version": "0.0.1"
}

step2:
use vue-cli create vue project, named vue-based.
step3:
in vue-based directory, execute " yarn run sere", and got error.

What is expected?

run sucess

What is actually happening?

$ yarn run serve

yarn run v1.13.0
$ vue-cli-service serve
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module '@vue/cli-plugin-eslint'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at idToPlugin (/Users/jk/工程/cmss-project/dm2/node_modules/@vue/cli-service/lib/Service.js:150:14)
    at Object.keys.concat.filter.map.id (/Users/jk/工程/cmss-project/dm2/node_modules/@vue/cli-service/lib/Service.js:189:20)
    at Array.map (<anonymous>)
    at Service.resolvePlugins (/Users/jk/工程/cmss-project/dm2/node_modules/@vue/cli-service/lib/Service.js:175:10)
    at new Service (/Users/jk/工程/cmss-project/dm2/node_modules/@vue/cli-service/lib/Service.js:34:25)
    at Object.<anonymous> (/Users/jk/工程/cmss-project/dm2/node_modules/@vue/cli-service/bin/vue-cli-service.js:16:17)
error Command failed with exit code 1.

OR

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module '@vue/cli-plugin-typescript'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at idToPlugin (/Users/jk/工程/learn/vue-cli-with-lerna/node_modules/@vue/cli-service/lib/Service.js:150:14)
    at Object.keys.concat.filter.map.id (/Users/jk/工程/learn/vue-cli-with-lerna/node_modules/@vue/cli-service/lib/Service.js:189:20)
    at Array.map (<anonymous>)
    at Service.resolvePlugins (/Users/jk/工程/learn/vue-cli-with-lerna/node_modules/@vue/cli-service/lib/Service.js:175:10)
    at new Service (/Users/jk/工程/learn/vue-cli-with-lerna/node_modules/@vue/cli-service/lib/Service.js:34:25)
    at Object.<anonymous> (/Users/jk/工程/learn/vue-cli-with-lerna/node_modules/@vue/cli-service/bin/vue-cli-service.js:16:17)

when copy this vue-cli based project outer of lerna dir, and reinstall node_modules, it can run success. however in lerna packages/vue-based it not work. when copy node_modules in lerna packages/vue-based to lerna root node_modules, yarn run serve run sucess.

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