出现错误前的操作步骤
- 初始化Vue项目
$ npm create vue@3.6.1
- 创建项目文件夹client
Vue.js - The Progressive JavaScript Framework
✔ Project name: › client
✔ Add TypeScript? › No
✔ Add JSX Support? › No
✔ Add Vue Router for Single Page Application development? › Yes
✔ Add Pinia for state management? › No
✔ Add Vitest for Unit Testing? › No
✔ Add ESLint for code quality? › No
- 安装依赖,运行开发服务
$ cd client
$ npm install
$ npm run dev
错误日志
日志路径:C:\Users\\AppData\Roaming\npm-cache_logs
日志详细:文章来源地址https://www.toymoban.com/news/detail-648462.html
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm@6.14.13
3 info using node@v14.17.1
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle client@0.0.0~predev: client@0.0.0
6 info lifecycle client@0.0.0~dev: client@0.0.0
7 verbose lifecycle client@0.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle client@0.0.0~dev: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\kode\pingtaikaifa\flask-vue-crud\client\node_modules\.bin;C:\Program Files\PowerShell\7;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files\OpenSSL-Win64\bin;C:\Python39\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;D:\mysql\bin;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Users\<user>\AppData\Roaming\Python\Python39\Scripts;C:\Program Files\Go\bin;C:\sqlite;C:\Program Files\dotnet\;C:\apache-jmeter-5.5\bin;C:\Program Files\Java\jdk-17.0.5\bin;JMETER_HOME%\bin;D:\programs\allure-2.9.0\bin;C:\Program Files\PowerShell\7\;D:\programs\Git\cmd;C:\Users\<user>\AppData\Local\Programs\Python\Python311\Scripts\;C:\Users\<user>\AppData\Local\Programs\Python\Python311\;C:\Users\<user>\scoop\apps\openjdk17\current\bin;C:\Users\<user>\scoop\apps\android-sdk\current\tools\bin;C:\Users\<user>\scoop\apps\ruby\current\bin;C:\Users\<user>\scoop\apps\ruby\current\gems\bin;C:\Users\<user>\scoop\shims;C:\Users\<user>\AppData\Local\Microsoft\WindowsApps;C:\Users\<user>\AppData\Roaming\npm;C:\Users\<user>\AppData\Local\Programs\Fiddler;C:\Users\<user>\go\bin;D:\programs\Microsoft VS Code\bin
9 verbose lifecycle client@0.0.0~dev: CWD: D:\kode\pingtaikaifa\flask-vue-crud\client
10 silly lifecycle client@0.0.0~dev: Args: [ '/d /s /c', 'vite' ]
11 silly lifecycle client@0.0.0~dev: Returned: code: 1 signal: null
12 info lifecycle client@0.0.0~dev: Failed to exec dev script
13 verbose stack Error: client@0.0.0 dev: `vite`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:375:28)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:375:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid client@0.0.0
15 verbose cwd D:\kode\pingtaikaifa\flask-vue-crud\client
16 verbose Windows_NT 10.0.19045
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v14.17.1
19 verbose npm v6.14.13
20 error code ELIFECYCLE
21 error errno 1
22 error client@0.0.0 dev: `vite`
22 error Exit status 1
23 error Failed at the client@0.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
解决步骤
- 官网下载最新LTS安装包:https://nodejs.org/dist/v18.17.1/node-v18.17.1-x64.msi
- 运行安装向导,覆盖旧版本目录(cmd查看:
where node
) - 验证安装成功:
node -v
文章来源:https://www.toymoban.com/news/detail-648462.html
到了这里,关于win10电脑npm run dev报错解决的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!