Error: Cannot find module 'C:\Users\86135\Desktop\item\node_modules\@vue\cli-service\bin\vue-cli-service.js'
时间: 2023-09-26 21:07:17 浏览: 309
出现错误信息"Error: Cannot find module 'C:\Users\86135\Desktop\item\node_modules\@vue\cli-service\bin\vue-cli-service.js'"通常有两种解决方案。首先,可以尝试删除项目中的node_modules文件夹,然后使用命令行运行"npm install"重新安装依赖项。这可以解决大多数问题。如果第一种方法不起作用,可以尝试第二种方法。在项目的node_modules文件夹下的.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"即可解决该问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span><span class="em">4</span>
相关问题
> vue-cli-service serve INFO Starting development server... ERROR Error: Cannot find module 'webpack' Require stack: - D:\Front_end\pc\node_modules\_webpack-dev-server@3.11.3@webpack-dev-server\lib\Server.js - D:\Front_end\pc\node_modules\_@vue_cli-service@3.5.3@@vue\cli-service\lib\commands\serve.js - D:\Front_end\pc\node_modules\_@vue_cli-service@3.5.3@@vue\cli-service\lib\Service.js - D:\Front_end\pc\node_modules\_@vue_cli-service@3.5.3@@vue\cli-service\bin\vue-cli-service.js Error: Cannot find module 'webpack' Require stack: - D:\Front_end\pc\node_modules\_webpack-dev-server@3.11.3@webpack-dev-server\lib\Server.js - D:\Front_end\pc\node_modules\_@vue_cli-service@3.5.3@@vue\cli-service\lib\commands\serve.js - D:\Front_end\pc\node_modules\_@vue_cli-service@3.5.3@@vue\cli-service\lib\Service.js - D:\Front_end\pc\node_modules\_@vue_cli-service@3.5.3@@vue\cli-service\bin\vue-cli-service.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15) at Function.Module._load (internal/modules/cjs/loader.js:746:27) at Module.require (internal/modules/cjs/loader.js:974:19) at require (internal/modules/cjs/helpers.js:93:18) at Object.<anonymous> (D:\Front_end\pc\node_modules\_webpack-dev-server@3.11.3@webpack-dev-server\lib\Server.js:23:17) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:12) at Module.require (internal/modules/cjs/loader.js:974:19) at require (internal/modules/cjs/helpers.js:93:18) at serve (D:\Front_end\pc\node_modules\_@vue_cli-service@3.5.3@@vue\cli-service\lib\commands\serve.js:38:30) at Service.run (D:\Front_end\pc\node_modules\_@vue_cli-service@3.5.3@@vue\cli-service\lib\Service.js:221:12) at Object.<anonymous> (D:\Front_end\pc\node_modules\_@vue_cli-service@3.5.3@@vue\cli-service\bin\vue-cli-service.js:36:9) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
这个错误提示是在运行 Vue.js 项目时出现的,错误信息显示找不到模块 'webpack',原因可能是 webpack 没有被正确安装或者没有被配置到系统环境变量中。你可以尝试通过以下方式解决这个问题:
1. 确保你已经安装了 webpack,如果没有安装可以使用 npm install webpack 或者 yarn add webpack 命令安装。
2. 如果已经安装了 webpack,可以尝试卸载并重新安装 webpack。
3. 检查系统环境变量中是否已经配置了 webpack 的路径。如果没有配置,请添加 webpack 的路径到系统环境变量中。
4. 确保你的项目中的 package.json 文件中已经正确配置了 webpack 相关的依赖。如果没有配置,请添加相关的依赖并重新安装。
Error: Cannot find module '@vue/cli-plugin-babel' Require stack: - D:\code-project\CS297390_20220228170923\client_home\node_modules\.store\@vue+cli-service@4.5.19\node_modules\@vue\cli-service\lib\Service.js - D:\code-project\CS297390_20220228170923\client_home\node_modules\.store\@vue+cli-service@4.5.19\node_modules\@vue\cli-service\bin\vue-cli-service.js at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15) at Module._load (node:internal/modules/cjs/loader:920:27) at Module.require (node:internal/modules/cjs/loader:1141:19) at require (node:internal/modules/cjs/helpers:110:18) at idToPlugin (D:\code-project\CS297390_20220228170923\client_home\node_modules\.store\@vue+cli-service@4.5.19\node_modules\@vue\cli-service\lib\Service.js:145:14) at D:\code-project\CS297390_20220228170923\client_home\node_modules\.store\@vue+cli-service@4.5.19\node_modules\@vue\cli-service\lib\Service.js:184:20 at Array.map (<anonymous>) at Service.resolvePlugins (D:\code-project\CS297390_20220228170923\client_home\node_modules\.store\@vue+cli-service@4.5.19\node_modules\@vue\cli-service\lib\Service.js:170:10) at new Service (D:\code-project\CS297390_20220228170923\client_home\node_modules\.store\@vue+cli-service@4.5.19\node_modules\@vue\cli-service\lib\Service.js:32:25) at Object.<anonymous> (D:\code-project\CS297390_20220228170923\client_home\node_modules\.store\@vue+cli-service@4.5.19\node_modules\@vue\cli-service\bin\vue-cli-service.js:15:17) { code: 'MODULE_NOT_FOUND', requireStack: [ 'D:\\code-project\\CS297390_20220228170923\\client_home\\node_modules\\.store\\@vue+cli-service@4.5.19\\node_modules\\@vue\\cli-service\\lib\\Service.js', 'D:\\code-project\\CS297390_20220228170923\\client_home\\node_modules\\.store\\@vue+cli-service@4.5.19\\node_modules\\@vue\\cli-service\\bin\\vue-cli-service.js' ] }
这个错误提示是说在你的项目里面找不到一个名为 "@vue/cli-plugin-babel" 的模块,它可能是你的项目所需要的依赖之一。你需要在项目根目录下执行以下命令来安装这个依赖:
```
npm install @vue/cli-plugin-babel -D
```
或者使用 yarn:
```
yarn add @vue/cli-plugin-babel -D
```
执行完命令后,尝试重新启动项目看看是否能够解决问题。
阅读全文