请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

yarn create @vitejs/app sys-manager 命令报错

PS D:\BaiduSyncdisk\vue3> yarn create @vitejs/app sys-manager
yarn create v1.22.19
[1/4] Resolving packages…
warning @vitejs/create-app@2.5.2: @vitejs/create-app has been moved to create-vite, please use ‘npm create vite@latest’ or ‘yarn create vite’ instead
[2/4] Fetching packages…
[3/4] Linking dependencies…
[4/4] Building fresh packages…
success Installed “@vitejs/create-app@2.5.2” with binaries:
- create-app
- cva
[######] 6/6
@vitejs/create-app is deprecated, use yarn create vite instead

C:\Users\liujun\AppData\Local\Yarn\Data\global\node_modules@vitejs\create-app\index.js:43
require(‘create-vite’)
^

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\liujun\AppData\Local\Yarn\Data\global\node_modules@vitejs\create-app\node_modules\create-vite\index.js from C:\Users\liujun\AppData\Local\Yarn\Data\global\node_modules@vitejs\create-app\index.js not supported.
C:\Users\liujun\AppData\Local\Yarn\Data\global\node_modules@vitejs\create-app\node_modules\create-vite\index.js is treated as an ES module file as it is
a .js file whose nearest parent package.json contains “type”: “module” which declares all .js files in that package scope as ES modules.
Instead rename C:\Users\liujun\AppData\Local\Yarn\Data\global\node_modules@vitejs\create-app\node_modules\create-vite\index.js to end in .cjs, change the requiring
code to use dynamic import() which is available in all CommonJS modules, or change “type”: “module” to “type”: “commonjs” in C:\Users\liujun\AppData\Local\Yarn\Data\global\node_modules@vitejs\create-app\node_modules\create-vite\package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

at Object.<anonymous> (C:\Users\liujun\AppData\Local\Yarn\Data\global\node_modules\@vitejs\create-app\index.js:43:1) {

code: ‘ERR_REQUIRE_ESM’
}
error Command failed.
Exit code: 1
Command: C:\Users\liujun\AppData\Local\Yarn\bin\create-app
Arguments: sys-manager
Directory: D:\BaiduSyncdisk\vue3
Output:

正在回答 回答被采纳积分+3

2回答

河畔一角 2023-06-05 14:45:27

yarn create vite报错说明电脑安装的yarn有问题,可以换成npm或者pnpm来安装

0 回复 有任何疑惑可以回复我~
  • 提问者 DF49 #1
    PS D:\BaiduSyncdisk\vue3> yarn create vite sys-manager --template vue
    yarn create v1.22.19
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    warning Pattern ["create-vite@^4.3.2"] is trying to unpack in the same destination "C:\\Users\\liujun\\AppData\\Local\\Yarn\\Cache\\v6\\npm-create-vite-4.3.2-c4abb0a29611e51af6abc2fdc3479d1cfc8ce489-integrity\\node_modules\\create-vite" as pattern ["create-vite@latest"]. This could result in non-deterministic behavior, skipping.[3/4] Linking dependencies...
    [4/4] Building fresh packages...
    
    success Installed "create-vite@4.3.2" with binaries:
          - create-vite
          - cva
    [#####] 5/5
    Scaffolding project in D:\BaiduSyncdisk\vue3\sys-manager...
    
    Done. Now run:
    
      cd sys-manager
      yarn
      yarn dev
    
    Done in 2.31s.
    PS D:\BaiduSyncdisk\vue3>
    回复 有任何疑惑可以回复我~ 2023-06-05 14:47:03
  • 提问者 DF49 #2
    解决了,应该是版本导致的命令有所变化
    回复 有任何疑惑可以回复我~ 2023-06-05 14:47:51
  • 河畔一角 回复 提问者 DF49 #3
    好的。。
    回复 有任何疑惑可以回复我~ 2023-06-05 14:48:21
河畔一角 2023-06-05 14:44:44

换成:

npm init vite@latest

试一下

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信