vue failed to start; 'vue-cli-service' is not recognized as an internal or external command, operable program or batch file.

Problem 1: Failed to start vue project:
vue failed to start; 'vue-cli-service' is not recognized as an internal or external command, operable program or batch file.
insert image description here

Or problem 2: npm i failed:
C:\Users\28602\AppData\Roaming\npm-cache_logs\2023-07-07T09_48_05_938Z-debug.log
insert image description here

Solution:
vue-cli-service is not an internal or external command, nor is it a runnable program error, you need
Step 1: Check if there is vue-cli-server in package.json If insert image description here
not, install vue-cli-service separately; npm install vue-cli-service -S
Step 2: Execute the npm install command
Step 3: Execute the npm run serve command to check whether the program is running normally
Step 4: If there is still an exception, delete the node modules directly, then npm iinstall dependencies, and then start the project
Step 5: If step 4 does not work, it may be that your vue-cli-server version is wrong, change it directly to version 4.5.0, then delete node modules, and then reinstall npm i dependencies, it will be fine at startup
insert image description here

Guess you like

Origin blog.csdn.net/i_am_a_div/article/details/131602115