Skip to content

Instantly share code, notes, and snippets.

@davidshq
Last active April 18, 2023 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidshq/a80e9d2f199c8fe3a7332255400ecca5 to your computer and use it in GitHub Desktop.
Save davidshq/a80e9d2f199c8fe3a7332255400ecca5 to your computer and use it in GitHub Desktop.
I mean, what?!?....

I'm working on merging two branches of an application. One is running Vue 2.7.x, the other Vue 2.6.x. I brought the dependencies in the older project up to those in Vue 2.7.x and tried running it and it cranks at me - it is still using Vue 2.6.x instead of Vue 2.7.x and so I see lots of:

ERROR in src/components/DataImportExport.vue:2:20 TS2614: Module '"vue"' has no exported member 'defineComponent'. Did you mean to use 'import defineComponent from "vue"' instead?
1 | <script lang="ts">
2 | import { computed, defineComponent, ref } from 'vue';
| ^^^^^^^^^^^^^^^
3 | import store from '@/store';
4 | import djangoRest from '@/django';
5 | import { Project } from '@/types';

Okay, fine. I delete the package-lock.json and the node_modules directory and then run the installation again. Everything installs without complaint so I launch the application again (npm run serve) and it starts throwing the same complaints.

I go through several more contortions attempting to please the npm gods without luck.

Ahh, I know. I'll delete the node_modules directory and package-lock.json files again, then I'll switch to the newer branch and install on that branch.

No issues. I type in npm run serve and the app boots up without any issues. It's successfully using Vue 2.7.x.

I switch branches again. I don't reinstall the node_modules, I already have them all (since node_modules is excluded from git so switching branches doesn't wipe them). npm run serve

Screenshot from 2023-04-18 15-38-08

lol.

Immediately after posting this I realized that while I deleted the package-lock.json file on the old branch I wasn't sure i had committed it. Shouldn't have mattered as I'd already pulled in the package-lock.json from the newer branch...but for the sake of completeness I went back to the old branch and:

  1. Deleted the package-lock.json
  2. Deleted the node_modules folder
  3. Committed the deletion of the package-lock.json
  4. Switched to the newer branch
  5. Ran npm, i
  6. Run npm run serve and saw app was running correctly (on Vue 2.7.x)
  7. Switched back to the older branch
  8. Verified that the package-lock.json had not magically reappeared
  9. Ran npm run serve again
  10. Laughing as the app continues to throw errors because it is still using Vue 2.6.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment