Umi: tyarn create umi报错

Created on 11 Oct 2018  ·  19Comments  ·  Source: umijs/umi

按照文档中使用tyarn create 命令创建umi项目的时候报错
$ tyarn create umi
yarn create v1.10.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "umi > [email protected]" has unmet peer dependency "react@*".
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
- create-umi
'D:Program' ▒▒▒▒▒ڲ▒▒▒▒ⲿ▒▒▒Ҳ▒▒▒ǿ▒▒▒▒еij▒▒▒
▒▒▒▒▒▒▒▒▒ļ▒▒▒
error Command failed.
Exit code: 1
Command: D:Program Files\nodejs\node_global\bin\create-umi
Arguments:
Directory: D:\SelfWorkfront-web\Reactmyapp
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

Most helpful comment

同样出现这个问题,推测可能是用户名含中文字符导致 .cmd文件 内容@"%~dp0\C:\Users\用户名AppData\Local\Yarn\Data\global\node_modules.bin\create-umi.cmd" %*
使用create-umi解决:先安装 create-umi(npm install -g create-umi) 再用create-umi创建项目 (create-umi 项目名)

All 19 comments

试过 windows 下没有问题,检查下本地的环境问题吧,比如环境变量之类的。

image

环境变量我也重新设置过了,没什么问题。我只是自己修改了node_cache和node_global

之前是以为和Program Files这个目录有问题,因为中间带有了空格,后面重新安装了Node 目录换成了Software,然后又报下面这个错
PS D:\SelfWorkfront-web\Reactmyapp> tyarn create umi
yarn create v1.10.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "umi > [email protected]" has unmet peer dependency "react@*".
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
- create-umi
文件名、目录名或卷标语法不正确。
error Command failed.
Exit code: 1
Command: D:\Software\NodeJS\node_global\bin\create-umi
Arguments:
Directory: D:\SelfWorkfront-web\Reactmyapp
Output:

我也遇到同样问题

你的node 是不是设置了node_cache和node_global这两项

@lsh123abc 是的额,不能自定义路径?

这个我就不清楚了哦

〒▽〒看你这么问,我还以为见到了曙光

请问这个问题解决了吗

我当时的原因是因为yarn的路径问题,使用了node_global的问题,导致报错

那应该怎么改呢

理不清楚的,其实直接使用create-umi,功能一样的。

同样出现这个问题,推测可能是用户名含中文字符导致 .cmd文件 内容@"%~dp0\C:\Users\用户名AppData\Local\Yarn\Data\global\node_modules.bin\create-umi.cmd" %*
使用create-umi解决:先安装 create-umi(npm install -g create-umi) 再用create-umi创建项目 (create-umi 项目名)

一样的错误,我的原因是没装git,汗。。

今天重装完系统碰到这个问题了:修改了node_cache和node_global之后再执行yarn create umi就报文件名、目录名或卷标语法不正确,后来把yarn的全局路径也改了就好了

yarn config set global-folder "你的磁盘路径"
yarn config set cache-folder "你的磁盘路径"

win环境,也是遇到了这个问题。出这个错误基本上就是环境变量路径错了。

我是找了环境变量,下是否有相关的可执行文件。 发现我有多个环境变量下有 creat-umi.bat
我删掉了不能执行的那个,就成了

今天重装完系统碰到这个问题了:修改了node_cache和node_global之后再执行yarn create umi就报文件名、目录名或卷标语法不正确,后来把yarn的全局路径也改了就好了

yarn config set global-folder "你的磁盘路径"
yarn config set cache-folder "你的磁盘路径"

我尝试了,不行

我直接切换npm create umi就可以了

考古问题,附上解决了我的这个问题的方法:https://blog.csdn.net/audreylau/article/details/102836114/

谢谢~

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kitebear picture kitebear  ·  3Comments

miaojinxing picture miaojinxing  ·  3Comments

ironyfive picture ironyfive  ·  3Comments

six-666 picture six-666  ·  3Comments

y2891663091 picture y2891663091  ·  4Comments