首页 > 解决方案 > Vue CLI 创建项目时出现错误代码 4058

问题描述

当我使用 CLI 工具创建一个新的 Vue 项目时,我得到了 4058 错误,这是我的代码:

Vue CLI v4.5.6
? Please pick a preset: Default ([Vue 2] babel, eslint)


Vue CLI v4.5.6
✨  Creating project in D:\PP\Others\StaticBlog\static-blog.
�  Initializing git repository...
⚙️  Installing CLI plugins. This might take a while...

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path D:\PP\Others\StaticBlog\static-blog\node_modules\@babel\parser
npm ERR! dest D:\PP\Others\StaticBlog\static-blog\node_modules\@babel\.parser.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'D:\PP\Others\StaticBlog\static-blog\node_modules\@babel\parser' -> 'D:\PP\Others\StaticBlog\static-blog\node_modules\@babel\.parser.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Echo\AppData\Roaming\npm-cache\_logs\2020-09-24T04_43_39_501Z-debug.log
 ERROR  command failed: npm install --loglevel error

似乎有些文件没有正确安装,所以我删除了目录npmnpm_cache重新安装,但还是一样。然后我尝试@babel\parser手动安装,同样。

我很困惑,请给我一些有用的建议!

以下是可能需要的信息:

OS: Win 7
npm version: 6.14.6
Node.js version: v12.18.4

标签: vue.jsvue-cli

解决方案


我也遇到了这个问题,我使用“-m yarn”选项成功创建了项目。

vue create your-project -m yarn

推荐阅读