Error Cannot read property 'parseComponent' of undefined when Vue is running or packaging

Scenes

Recently, after pulling the code npm install of a project, npm run dev reported the following error
Cannot read property 'parseComponent' of undefined
. After searching on the Internet, the solution is as follows.

solve

Look at the version of vue in package.json or package-lock.json. For example, the version of vue in the figure below is 2.6.10.
insert image description here
The error is caused by the inconsistency between the version of vue and the version of vue-template-compiler. You can look at it again Whether the version of vue-template-compiler is consistent with the version of vue. The picture below is a screenshot after I solved it.
insert image description here

For example, the examples in the figure are consistent, that is, both vue and vue-template-compiler should be 2.6.0. Execute the following command to install the same version of vue-template-compiler as vue

npm install [email protected]

Guess you like

Origin blog.csdn.net/zhangxiaodui/article/details/128422508