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
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:
- Deleted the package-lock.json
- Deleted the node_modules folder
- Committed the deletion of the package-lock.json
- Switched to the newer branch
- Ran
npm, i
- Run
npm run serve
and saw app was running correctly (on Vue 2.7.x) - Switched back to the older branch
- Verified that the package-lock.json had not magically reappeared
- Ran
npm run serve
again - Laughing as the app continues to throw errors because it is still using Vue 2.6.x