After the vue project is started, the page is completely blank and an error is reported: Uncaught TypeError: Cannot read properties of undefined (reading 'install')

question:

After the vue project is started, the page is completely blank and an error is reported: Uncaught TypeError: Cannot read properties of undefined (reading 'install')

Insert image description here

solution:

Reason: The version of vue-router is wrong. After uninstalling the original version, download it again. Uninstall the
previous vue-router first:

npm uninstall vue-router

Download the version suitable for vue2:

npm i vue-router@3.5.2

After trying it and it still didn’t work, I found on the Internet that I need to add -legacy-peer-deps to bypass the automatic installation of peerDependency and ensure that the different versions of the modules used by each introduced dependency coexist.

npm i vue-router@3.5.2 -legacy-peer-deps

After the execution is completed, the project can be started normally.

Problems encountered:

This error occurred when using npm to uninstall the previous vue-router. The error is as follows:

npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path E:\nodejs\npm_cache_cacache\tmp\7ab9b301
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open ‘E:\nodejs\npm_cache_cacache\tmp\7ab9b301’
npm ERR! [Error: EPERM: operation not permitted, open ‘E:\nodejs\npm_cache_cacache\tmp\7ab9b301’] {
npm ERR! errno: -4048,
npm ERR! code: ‘EPERM’,
npm ERR! syscall: ‘open’,
npm ERR! path: ‘E:\nodejs\npm_cache\_cacache\tmp\7ab9b301’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It’s possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.

Reason: Because ordinary users do not have permission to open the npm_global and node_cache folders, just empower ordinary users.
This problem can be solved by opening the npm_global and node_cache files with ordinary user permissions. The steps are as follows:

Insert image description hereInsert image description here

Reference link for error reporting when the page is blank after starting the project: https://blog.csdn.net/weixin_43585289/article/details/126738520
Reference link for error reporting when using npm to uninstall or download dependencies: https://blog.csdn.net/weixin_51281841/article/ details/124087948

Guess you like

Origin blog.csdn.net/m0_46459413/article/details/127770469