arco-design/arco-cli

arco-cli 无法初始化项目报错Error: Failed to copy project content

AdvanceOrange opened this issue · 9 comments

Describe the bug
PS C:\Users***\Desktop\study_vue\hello-arco-pro> arco init hello-arco-pro

    ___                    ____            _
   /   |  ______________  / __ \___  _____(_)___ _____
  / /| | / ___/ ___/ __ \/ / / / _ \/ ___/ / __ `/ __ \
 / ___ |/ /  / /__/ /_/ / /_/ /  __(__  ) / /_/ / / / /
/_/  |_/_/   \___/\____/_____/\___/____/_/\__, /_/ /_/
                                         /____/

                                            v1.26.1

? 请选择你希望使用的技术栈 Vue
? 请选择所要创建项目的类型 Arco Pro 项目
? 请选择 Arco Pro 模板 完整版(包含所有页面)

正在初始化项目于 C:\Users***\Desktop\study_vue\hello-arco-pro\hello-arco-pro
√ 获取项目模板成功
× 模板内容拷贝失败
Error: Failed to copy project content.
npm WARN config global --global, --local are deprecated. Use --location=global instead.

at module.exports (C:\Users\***\.arco_template_cache\1655866434222\node_modules\arco-design-pro-vue\.arco-cli\init.js:25:13)
at C:\Program Files\node-v16.15.1-win-x64\node_modules\node_global\node_modules\arco-cli\node_modules\arco-cli-create-project\lib\index.js:129:23
at Generator.next (<anonymous>)
at fulfilled (C:\Program Files\node-v16.15.1-win-x64\node_modules\node_global\node_modules\arco-cli\node_modules\arco-cli-create-project\lib\index.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Error: EBUSY: resource busy or locked, rmdir 'C:\Users***.arco_template_cache\1655866434222\node_modules\arco-design-pro-vue'
node:fs:1180
return handleErrorFromBinding(ctx);
^

Error: EBUSY: resource busy or locked, rmdir 'C:\Users*.arco_template_cache\1655866434222\node_modules\arco-design-pro-vue'
at Object.rmdirSync (node:fs:1180:10)
at rmdirSync (C:\Program Files\node-v16.15.1-win-x64\node_modules\node_global\node_modules\arco-cli\node_modules\fs-extra\lib\remove\rimraf.js:264:13)
at rimrafSync (C:\Program Files\node-v16.15.1-win-x64\node_modules\node_global\node_modules\arco-cli\node_modules\fs-extra\lib\remove\rimraf.js:243:7)
at C:\Program Files\node-v16.15.1-win-x64\node_modules\node_global\node_modules\arco-cli\node_modules\fs-extra\lib\remove\rimraf.js:279:39
at Array.forEach ()
at rmkidsSync (C:\Program Files\node-v16.15.1-win-x64\node_modules\node_global\node_modules\arco-cli\node_modules\fs-extra\lib\remove\rimraf.js:279:26)
at rmdirSync (C:\Program Files\node-v16.15.1-win-x64\node_modules\node_global\node_modules\arco-cli\node_modules\fs-extra\lib\remove\rimraf.js:269:7)
at rimrafSync (C:\Program Files\node-v16.15.1-win-x64\node_modules\node_global\node_modules\arco-cli\node_modules\fs-extra\lib\remove\rimraf.js:243:7)
at C:\Program Files\node-v16.15.1-win-x64\node_modules\node_global\node_modules\arco-cli\node_modules\fs-extra\lib\remove\rimraf.js:279:39
at Array.forEach () {
errno: -4082,
syscall: 'rmdir',
code: 'EBUSY',
path: 'C:\Users\
*\.arco_template_cache\1655866434222\node_modules\arco-design-pro-vue'
}

To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: win10
  • node version v16.15.1

Additional context
Add any other context about the problem here.

mac 端同样报错, 使用VUE-> Arco Pro 项目模版

✔ 获取项目模板成功
✖ 模板内容拷贝失败
Error: Failed to copy project content.
npm WARN config production Use --omit=dev instead.

at module.exports (/Users/xxx/.arco_template_cache/1655866634338/node_modules/arco-design-pro-vue/.arco-cli/init.js:25:13)
at /usr/local/lib/node_modules/arco-cli/node_modules/arco-cli-create-project/lib/index.js:129:23
at Generator.next ()
at fulfilled (/usr/local/lib/node_modules/arco-cli/node_modules/arco-cli-create-project/lib/index.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

image
我在本地没有复现,还有更多信息吗

方便的话可以试下直接克隆这个仓库初始化项目,arco-cli 也是调用的这个命令实现模板内容拷贝。

@MisterLuffy node 版本从 v16.15.1 降低至 v16.13.1 错误发生改变

√ 获取项目模板成功
√ 模板内容拷贝完成
√ 模板内容适配完成
× 项目依赖安失败,你可以稍后尝试手动安装项目依赖
Error: Command 「npm install」 executed failed:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: arco-design-pro-vue@1.0.0
npm ERR! Found: eslint@8.7.0
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^8.7.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^5.16.0 || ^6.8.0 || ^7.2.0" from eslint-config-airbnb-base@14.2.1
npm ERR! node_modules/eslint-config-airbnb-base
npm ERR!   dev eslint-config-airbnb-base@"^14.2.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Program Files\nodejs\node_modules\node_cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Program Files\nodejs\node_modules\node_cache\_logs\2022-06-22T09_28_41_700Z-debug.log

 arco-init  项目初始化失败!
Error: spawnSync yarn.cmd ENOENT

我的npm版本是:8.1.2 ,执行 npm install 时需要携带这个参数 --legacy-peer-deps,目前项目成功运行

降级node 到16.13.2 正常跑通不报错. @AdvanceOrange

降级node 到16.13.2 正常跑通不报错. @AdvanceOrange

docker环境下依旧报错

✖ Project dependency installation failed, you can try to manually install them later
Error: Command 「npm install」 executed failed:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: arco-design-pro-vue@1.0.0
npm ERR! Found: eslint@8.7.0
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^8.7.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^5.16.0 || ^6.8.0 || ^7.2.0" from eslint-config-airbnb-base@14.2.1
npm ERR! node_modules/eslint-config-airbnb-base
npm ERR!   dev eslint-config-airbnb-base@"^14.2.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /root/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-07-01T03_39_51_700Z-debug.log

 arco-init  Project init failed!
Error: spawnSync yarn ENOENT

@fangmuke npm install 时需要携带这个参数 --legacy-peer-deps

我也遇到了同样的问题

  1. win10系统, nodejs = v16.16.0
  • ❌arco init test1 报错
      ___                    ____            _
     /   |  ______________  / __ \___  _____(_)___ _____
    / /| | / ___/ ___/ __ \/ / / / _ \/ ___/ / __ `/ __ \
   / ___ |/ /  / /__/ /_/ / /_/ /  __(__  ) / /_/ / / / /
  /_/  |_/_/   \___/\____/_____/\___/____/_/\__, /_/ /_/
                                           /____/

                                              v1.27.3

? 请选择你希望使用的技术栈 React
? 请选择所要创建项目的类型 Arco Pro 项目
? 请选择你想要使用的开发框架 Vite (https://vitejs.dev/)
? 请选择 Arco Pro 模板 完整版(包含所有页面)

正在初始化项目于 E:\Test\vue\test2
✔ 获取项目模板成功
✖ 模板内容拷贝失败
Error: Failed to copy project content.
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
  1. 按上面楼主描述,切换成14.20.1
  • ✔arco init test1 创建成功
  • ✔npm run dev 正常运行, 显示正常
  • ✔把node切换成16.16.0, npm run dev正常,显示正常
  1. win10下 wsl (ubantu 20) , nodejs = v15.14.0
  • ✔arco init test2 创建成功

  • ❌但是 npm install 报错, 跟楼上fangmuke 错误一摸一样
    image

  • ✔根据上面描述加参数, npm install --legacy-peer-deps 正常

  • ✔npm run dev 正常

  • ❌但是浏览器打开 localhost:3000 不能正常显示
    image

  1. 后面想重现以下问题, 此时 Nodejs = 16.16.0,
  • ❌arco init test4 这里变成正常了
    image