vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.76k stars 6.33k forks source link

Unable to test CLI plugin from filesystem if node_modules directory is present #3757

Open i-hardy opened 5 years ago

i-hardy commented 5 years ago

Version

3.5.5

Environment info

System:
    OS: macOS 10.14.2
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  Binaries:
    Node: 11.3.0 - ~/.nvm/versions/node/v11.3.0/bin/node
    Yarn: 1.13.0 - ~/.nvm/versions/node/v11.3.0/bin/yarn
    npm: 6.8.0 - ~/.nvm/versions/node/v11.3.0/bin/npm
  Browsers:
    Chrome: 73.0.3683.86
    Firefox: Not Found
    Safari: 12.0.2
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0-beta.3
    @vue/babel-plugin-transform-vue-jsx:  1.0.0-beta.3
    @vue/babel-preset-app:  3.5.5
    @vue/babel-preset-jsx:  1.0.0-beta.3
    @vue/babel-sugar-functional-vue:  1.0.0-beta.3
    @vue/babel-sugar-inject-h:  1.0.0-beta.3
    @vue/babel-sugar-v-model:  1.0.0-beta.3
    @vue/babel-sugar-v-on:  1.0.0-beta.3
    @vue/cli-overlay:  3.5.1
    @vue/cli-plugin-babel: ^3.5.0 => 3.5.5
    @vue/cli-plugin-eslint: ^3.5.0 => 3.5.1
    @vue/cli-plugin-unit-jest: ^3.5.0 => 3.5.3
    @vue/cli-service: ^3.5.0 => 3.5.3
    @vue/cli-shared-utils:  3.5.1
    @vue/component-compiler-utils:  2.6.0
    @vue/eslint-config-prettier: ^4.0.1 => 4.0.1
    @vue/preload-webpack-plugin:  1.1.0
    @vue/test-utils: 1.0.0-beta.29 => 1.0.0-beta.29
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^5.0.0 => 5.2.2
    jest-serializer-vue:  2.0.2
    vue: ^2.6.6 => 2.6.10
    vue-cli-plugin-tdd: file:/Users/imogen.hardy/tooling/vue-cli-plugin-tdd => 1.0.0
    vue-eslint-parser:  2.0.3
    vue-hot-reload-api:  2.3.3
    vue-jest:  3.0.4
    vue-loader:  15.7.0
    vue-rx: ^6.0.1 => 6.1.0
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.21 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
  npmGlobalPackages:
    @vue/cli: 3.5.5

Steps to reproduce

Create a vue-cli plugin according to the steps in this blog post: https://itnext.io/how-to-build-a-simple-vue-cli-plugin-a2e1323de1a0 (or pull Natalia's plugin). Make sure it has some dependency to create a node_modules folder.

Create a project using vue create that includes Babel, ESLint, Sass and Jest

Run the UI for the project using vue ui

Add the plugin from the file system via the UI via the 'browse local plugin' button.

Attempt to install the plugin

What is expected?

The plugin is installed, or a meaningful error message is generated

What is actually happening?

A confusing error relating to a missing Babel dependency:

npm ERR! path /Users/imogen.hardy/tooling/test-project/node_modules/.staging/vue-cli-plugin-rx-a2eb339d/node_modules/@babel/code-frame
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/imogen.hardy/tooling/test-project/node_modules/.staging/vue-cli-plugin-rx-a2eb339d/node_modules/@babel/code-frame' -> '/Users/imogen.hardy/tooling/test-project/node_modules/.staging/@babel/code-frame-ba895aff'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/imogen.hardy/.npm/_logs/2019-04-04T17_29_35_101Z-debug.log
 ERROR  command failed: npm install --loglevel error
LinusBorg commented 5 years ago

An actual reproduction reprository would help following your instructions.

i-hardy commented 5 years ago

Sorry for the delay, repro is here https://github.com/i-hardy/vue-cli-bug-repro-3757

LinusBorg commented 5 years ago

Thanks

LinusBorg commented 5 years ago

Can't reproduce this. After removing the local dependency that still pointed to your harddrive folder and adding the plugin through the UI, everything worked ...