纱线全局安装到当前目录

编程入门 行业动态 更新时间:2024-10-27 21:24:33
本文介绍了纱线全局安装到当前目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试让 React Native 在我的 Linux 机器上运行.为了让 cli 运行,我运行了:

I am trying to get React Native working on my Linux machine. In order to get the cli running I have run:

$ yarn global add react-native-cli

并查看:

yarn global v0.16.1 warning No license field [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Installed react-native-cli@1.0.0 with binaries: - react-native Done in 1.70s.

一切都安装得很好,但是当我尝试创建一个新的 React Native 项目时,我得到:

Everything installs just fine, but when I attempt to create a new React Native project, I get:

$ react-native init Test react-native: command not found

来发现,yarn 正在将依赖项安装到当前目录中的任何位置,而不是全局安装它.这有什么帮助吗?我正在运行 Lubuntu 16.04.

Come to find out, yarn is installing the dependency into whatever the current directory is instead of installing it globally. Any help on this? I'm running Lubuntu 16.04.

推荐答案

编辑

现在它工作:

yarn config set prefix/usr/local

检查

yarn config 获取前缀

请注意,只有可执行文件才会安装到此 prefix 位置.Windows 上的软件包安装在 %USERPROFILE%\AppData\Local\Yarn\config\global\node_modules 中.

Notice that only executables will be installed to this prefix location. Packages i.e. on Windows are installed in %USERPROFILE%\AppData\Local\Yarn\config\global\node_modules.

在 Windows 上我这样做:

On Windows I do:

mkdir ~/yarn-global yarn config set prefix ~/yarn-global

全局路径尚未永久配置.我们只能读取设置:

> yarn global bin C:\Program Files\nodejs

当我尝试安装 elm-upgrade 时,日志中出现错误 %USERPROFILE%\AppData\Local\Yarn\config\global\yarn-error.log

When I tried to install elm-upgrade, I got error in log %USERPROFILE%\AppData\Local\Yarn\config\global\yarn-error.log

Trace: Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\elm-upgrade.cmd' at Error (native)

但是elm-upgrade安装在%USERPROFILE%\AppData\Local\Yarn\config\global\node_modules\.bin.

But elm-upgrade was installed in %USERPROFILE%\AppData\Local\Yarn\config\global\node_modules\.bin.

相关:

  • 全局 bin 的位置与文档不匹配 github/yarnpkg/yarn/issues/1194

更多推荐

纱线全局安装到当前目录

本文发布于:2023-07-04 10:06:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1023040.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:纱线   全局   目录

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!