vik*_*mvi 18 macos bash yarnpkg
Mac 操作系统 10.13.6
我是如何安装纱线的
npm install --global yarn
Run Code Online (Sandbox Code Playgroud)
纱线安装路径是/Users/useName/.config/yarn
然后运行下面的命令
yarn create react-app app-name
Run Code Online (Sandbox Code Playgroud)
这工作得很好,但是当我尝试运行时yarn add package_name,它抛出错误
bash: yarn: command not found
Run Code Online (Sandbox Code Playgroud)
奇怪的是,在我全局(?)安装了yarn的终端关闭并再次打开后,找不到yarn命令。
小智 10
在 Mac 命令行上执行以下命令:
export PATH=~/.npm-global/bin:$PATH.
Run Code Online (Sandbox Code Playgroud)
这将设置 NPM 路径目录
尝试export PATH=~/.yarn/bin:$PATH进入.profile!**
或者
尝试:如果你在 bash 上尝试添加alias yarn=~/.yarn/bin/yarn.js
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
Run Code Online (Sandbox Code Playgroud)
create-react-app.dev/docs/getting-started
试试这个Stackoverflow :)
小智 5
根据此Yarn 安装指南, “管理 Yarn 的首选方法是通过 Corepack,这是从 16.10 开始随所有 Node.js 版本附带的新二进制文件。”
截至 2023 年 - 在 Mac 上 - 对于 Node.js >=16.10 - 在将节点更新到 16.17 后这对我有用:
corepack enable
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
56170 次 |
| 最近记录: |