报错内容如下:
Error: Cannot find module 'D:\teduTeam\@vue\cli-service\bin\vue-cli-service.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
原因可能是我移动的时候把node_modules模块也一起移动,依赖的东西互相产生了影响,然后我尝试删除包再重新依然出现上述报错,直到对比了我正常能打开的vue项目中的\bin\vue-cli-service.js文件,才发现有不对,于是我打开bin\vue-cli-service.cmd文件,修改代码为:
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\@vue\cli-service\bin\vue-cli-service.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\@vue\cli-service\bin\vue-cli-service.js" %*
)
再次npm run serve
,终于正常!
tips:
以后移动项目千万不要再傻傻的把包也移走!!!~
标签:node,bin,vue,cli,service,报错,移动 From: https://www.cnblogs.com/guanyyang/p/16878106.html