Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): 修复没有全局安装 @tarojs/cli 依赖的时候执行 npm run XXX 报错 #2226

Closed
wants to merge 3,605 commits into from

Conversation

shaodahong
Copy link

@shaodahong shaodahong commented Feb 20, 2019

使用 npx @tarojs/cli init myApp 初始化项目后,进入到项目文件夹执行 yarn dev:alipay, 提示 sh: taro: command not found

因为我没有全局安装 cli, 所以在 package.json 中增加 @tarojs/cli 依赖,这样会使用当前项目中的 @tarojs/cli

我看了下对 taro update 也没有影响,不知道有没有其他疏忽的,麻烦看下 @luckyadam

Pines-Cheng and others added 30 commits December 29, 2018 10:37
docs: update component.md close#1750
* 使用findDOMNode 做优化,兼容React
@luckyadam
Copy link
Member

cli 在模板里还是不加入到项目的依赖里,让用户自己去选择是否加入,之前有加入过,但是会和全局安装的 cli 发生冲突导致问题不好排查,所以去掉了

@shaodahong
Copy link
Author

嗯,这是一个问题,本地版本和全局版本对有些用户来说确实容易混淆,但是看现在包管理的方式绝大都是项目依赖,我看文档 Taro 是优先建议全局,在现在 npx 的方式下,大多数项目都是建议项目管理,比如 typescript create-react-app,当然现在让用户选择也是一种方式吧,我能够理解

@luckyadam
Copy link
Member

@shaodahong 这样子,我们思考一下,文档同时也要更新一下了

@shaodahong
Copy link
Author

好的

@xiaohaoo
Copy link

我也遇到同样问题,在使用npx taro build --type h5 --watch时出现command not found: taro问题,请问这个该怎么解决? @luckyadam

@Garfield550
Copy link
Collaborator

@xiaohaoo 自己加一下 @tarojs/cli 在项目里。

yarn add -D @tarojs/cli

yarn taro build --type h5 --watch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet