After running the new project under git clone, the error 'vue-cli-service' is not an internal or external command, nor is it an operable program or batch file.

Error: 'vue-cli-service' is not recognized as an internal or external command, operable program
or batch file. insert image description here
Because there is no node_modules package in the project, you need to run npm install and
there is no error after running, but there is a warning
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
added 9 packages from 42 contributors in 12.831s
insert image description here
The warning message shows that the current npm version of your computer is suitable for lockfileVersion@1, but your package-lock.json is derived from lockfileVersion @2. Because a certain plugin used in the code can only be downloaded with a specific version of npm, an error will be reported and npm install will fail. In this case, npm needs to be upgraded.

Before upgrading, win+r and enter cmd to open the run command box, enter npm -v to view the npm version,
press x on windows, and then press i to bring up the power shell page. Then run the command (administrator)
npm install [email protected] npm
xx.xx.xx is the npm version number you want to upgrade

After the upgrade is successful, in the run command box, enter npm -v again to check whether the npm version is upgraded successfully

After the upgrade is successful, go back to the project and delete the node_modules folder and package-lock.js file.
Run the npm install command again, and it succeeds.
Then run the npm run serve command. The project runs successfully, and the problem is solved!

Guess you like

Origin blog.csdn.net/weixin_44812604/article/details/128218650