Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symlinked node_modules => second npm install breaks stuff #3426

Open
antoinematyja opened this issue Feb 6, 2019 · 2 comments
Open

Symlinked node_modules => second npm install breaks stuff #3426

antoinematyja opened this issue Feb 6, 2019 · 2 comments

Comments

@antoinematyja
Copy link

Version

3.4.0

Environment info

  System:
    OS: macOS 10.14.2
    CPU: (4) x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
  Binaries:
    Node: 10.15.0 - /usr/local/bin/node
    Yarn: 1.5.1 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 59.0.2
    Safari: 12.0.2
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0-beta.2 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0-beta.2 
    @vue/babel-preset-app:  3.4.0 
    @vue/babel-preset-jsx:  1.0.0-beta.2 
    @vue/babel-sugar-functional-vue:  1.0.0-beta.2 
    @vue/babel-sugar-inject-h:  1.0.0-beta.2 
    @vue/babel-sugar-v-model:  1.0.0-beta.2 
    @vue/babel-sugar-v-on:  1.0.0-beta.2 
    @vue/cli-overlay:  3.4.0 
    @vue/cli-plugin-babel: ^3.4.0 => 3.4.0 
    @vue/cli-plugin-eslint: ^3.4.0 => 3.4.0 
    @vue/cli-service: ^3.4.0 => 3.4.0 
    @vue/cli-shared-utils:  3.4.0 
    @vue/component-compiler-utils:  2.5.2 
    @vue/eslint-config-standard: ^4.0.0 => 4.0.0 
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/web-component-wrapper:  1.2.0 
    babel-helper-vue-jsx-merge-props:  2.0.3 
    eslint-plugin-vue: ^5.0.0 => 5.1.0 
    vue: ^2.5.21 => 2.5.22 
    vue-content-loader: ^0.2.1 => 0.2.1 
    vue-eslint-parser:  2.0.3 
    vue-googlemaps: ^0.1.2 => 0.1.2 
    vue-hot-reload-api:  2.3.1 
    vue-i18n: ^8.7.0 => 8.7.0 
    vue-loader:  15.6.2 
    vue-observe-visibility:  0.3.1 
    vue-resize:  0.4.5 
    vue-router: ^3.0.1 => 3.0.2 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.5.21 => 2.5.22 
    vue-template-es2015-compiler:  1.8.2 
    vuex: ^3.0.1 => 3.0.1 
    vuex-router-sync: ^5.0.0 => 5.0.0 
  npmGlobalPackages:
    @vue/cli: 3.4.0

Steps to reproduce

  • Create a project with vue-cli
  • Create a node_modules directory somewhere else
  • Create a node_modules symlink in your project, targeting the node_modules directory previously created
  • Run npm install twice

What is expected?

The second npm install shouldn't do anything

What is actually happening?

The second npm install modifies the package-lock.json and uninstall some dependencies required for npm run build.


I use a capistrano architecture in production for my project: I have a "shared" node_modules directory, and for every new deployment, the node_modules directory is symlinked to this shared directory, to avoid reinstalling everything.

It works well the first time, however the second time some dependencies are missing.

I noticed that at the first npm install run, yorkie does nothing:

> [email protected] install /.../node_modules/yorkie
> node bin/install.js

setting up Git hooks
can't find .git directory, skipping Git hooks installation

However, after the second npm install run, this happens:

> [email protected] install /Users/antoinematyja/clic2buy/michelin/node_modules/@vue/cli-service/node_modules/yorkie
> node bin/install.js

setting up Git hooks
trying to install from sub 'node_module' directory, skipping Git hooks installation

Then the package-lock.json is modified automatically, and some dependencies are missing in node_modules.

For example, after the first npm install:

$ ls node_modules/@vue
babel-helper-vue-jsx-merge-props	babel-sugar-v-model			cli-shared-utils
babel-plugin-transform-vue-jsx		babel-sugar-v-on			component-compiler-utils
babel-preset-app			cli-overlay				eslint-config-standard
babel-preset-jsx			cli-plugin-babel			preload-webpack-plugin
babel-sugar-functional-vue		cli-plugin-eslint			web-component-wrapper
babel-sugar-inject-h			cli-service

And after the second npm install:

$ ls node_modules/@vue
cli-plugin-babel	cli-plugin-eslint	cli-service		eslint-config-standard

This issue doesn't happen when I'm not using a symlinked node_modules directory. In that case, yorkie goes fine at the first npm install and doesn't do anything if I run npm install again.

@antoinematyja
Copy link
Author

This issue only happens with vue-cli generated projects, so I guess the solution is in the vue-cli generated package.json.

Everything seems to point towards the yorkie module, however https://github.com/yyx990803/yorkie we can't create issues on this project. And since vue-cli chose to use it, I guess the issue belongs here.

@Tofandel
Copy link

Tofandel commented Jan 13, 2020

Have a look there babel/babel-loader#149 this might be related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants