[Bug]: herd isolate-node ignores --site and writes .nvmrc into the current folder
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Bắt đầu với cli/app.php:1592 và cli/Valet/Site.php:1303-1306 để lần theo cách --site chọn đường dẫn đích; so sánh với cách xử lý unisolate-node tại cli/app.php:1619. Đồng thời kiểm tra bin/herd:148, nơi shell hook kiểm tra --site=. Công việc được xem là hoàn tất khi thao tác isolation ghi .nvmrc vào thư mục của site được chỉ định, site không xác định trả về lỗi và hook xử lý thứ tự đối số được ghi trong tài liệu mà không thay đổi phiên bản Node của thư mục hiện tại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Platform
macOS
Operating system version
macOS 27.0.1 (26A434)
System architecture
ARM64 (M1, M2, etc)
Herd Version
2.0.2 (Build: 71)
PHP Version
n/a (Node 26.12.0 through Herd's nvm; global PHP is 8.5.10)
Bug description
herd isolate-node 26 --site=example ignores --site. The docs show this form for sites whose name doesn't match their folder, but the .nvmrc lands in the current folder instead of the site's, overwriting any .nvmrc already there. It still says "The site is now using Node 26." and exits 0, even for a site that doesn't exist.
herd unisolate-node --site=example does look in the site's folder, so it says it worked and leaves the stray .nvmrc behind.
Because nvm and Herd's shell hook pick up .nvmrc from parent folders, running it from ~/Herd would switch Node for every site below it without its own .nvmrc (I saw the hook switch after a cd into a subfolder). From the hook's code it would also nvm install a missing version; I didn't test that.
Expected: the .nvmrc goes into the site's folder, and an unknown site name gives an error.
Cause (herd.phar 2.0.2): isolate-node always passes getcwd() to Site::isolateNode() (cli/app.php:1592), which uses that path whenever it's set (cli/Valet/Site.php:1303-1305), so the site lookup at :1306 never runs. unisolate-node passes no path (app.php:1619), so it finds the site.
Possible fix: pass null instead of getcwd() when --site is set (app.php:1592, and :1580 for the form without a version).
Also: bin/herd:148 only checks $2 for --site=, so with the docs' argument order (and for --help) it runs nvm use in the current folder as well.
Thanks for the quick fixes on #1770 and #1771.
Steps to reproduce
- Herd 2.0.2 with any installed Node version (26 here) and a linked or parked site
examplethat has no.nvmrc. - From a folder that isn't a site:
mkdir ~/herd-test && cd ~/herd-test, thenherd isolate-node 26 --site=example. ls -A ~/herd-test ~/Herd/example: the.nvmrcis in~/herd-test, not in the site's folder, andherd isolated-nodedoesn't list the site.herd unisolate-node --site=example: it says it worked, but~/herd-test/.nvmrcis still there.- Clean up with
rm ~/herd-test/.nvmrc.
Relevant log output
# Paths changed for privacy. For the linked-site part I ran herd.phar against a copy of my Herd config, so my real setup stayed untouched.
# Same behaviour with a stock .zshrc (only Herd's own lines) and with no shell config at all.
$ cd ~/herd-test
$ herd isolate-node --site=example 26
The site is now using Node 26.
$ ls -A ~/herd-test
.nvmrc
$ cat ~/herd-test/.nvmrc
26
$ ls -A ~/Herd/example
$ herd isolated-node
+------+--------------+
| Path | Node Version |
+------+--------------+
$ herd unisolate-node --site=example
The site is now using the default Node version.
$ ls -A ~/herd-test
.nvmrc
# The docs' argument order, with a site name that doesn't exist:
$ cd ~/herd-test2
$ herd isolate-node 26 --site=nosuchsite
The site is now using Node 26.
Found '~/herd-test2/.nvmrc' with version <26>
Now using node v26.12.0 (npm v11.20.0)
$ echo $?
0
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 124
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của beyondcode/herd-community
-
fixed-in-next-release macOS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
beyondcode/herd-community#1771 ·
-
[Bug]: PHP 8.3 php.ini missing auto_prepend_file and herd-ext extension lines (dump() undefined)Đang mởmacOS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
beyondcode/herd-community#1693 ·
-
macOS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
beyondcode/herd-community#1602 ·
-
[Bug]: herd php:update hangs indefinitely on Windows when background PHP processes hold file locksĐang mởwindows
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
beyondcode/herd-community#1775 ·
-
windows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
beyondcode/herd-community#1772 · 1 bình luận · 1 reaction ·
Tất cả issue của beyondcode/herd-community
Issue tương tự
-
bug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mvanhorn/cli-printing-press#5146 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
BSData/age-of-sigmar-4th#1405 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
MagnaCapax/PMSS#1142 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[Bug]: Queen's own Ollama model loses num_ctx when a running session switches to itCó thể đã có người làm @anasamin26 đã nhận hôm nay. Đang mởbug enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
aden-hive/hive#7508 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày