jaredly / jaredly/reprocessing-example-cross-platform

package-lock.json can lead to installation errors

Đang mở
#3 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
OCaml
Star
50
Fork
5
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I've noticed a problem with re-installing `node_modules` multiple times with the generated `package-lock.json` file. It seems to stem from various dependencies using different versions of the `bs-platform` package; when installing initially all dependencies install `bs-platform@2.1.1`. Later installation attempts using the `package-lock` will download conflicting versions of that package (`matchenv` uses `bs-platform@3.2.0`, whereas `reprocessing-scripts` still gets `bs-platform@2.1.1`). This seems to cause an error during installation due to missing files in `bs-platform`.

What can I do to get a consistent build without deleting `package-lock.json` every time I run `npm i`? Is there a way to force all of the dependencies to use the same `bs-platform`?

**Reproduction steps:**

1. delete `package-lock.json` (and anything in `node_modules`) and run `npm i`, all of the necessary dependencies will install correctly and a new `package-lock` will be generated.

2. delete all of the `node_modules` and re-install (`npm i`), the installation will succeed (with several duplicated package warnings), but `package-lock` will be updated again.

3. Deleting `node_modules` a third time and attempting to reinstall leads to the following error output:

```
ppx-env@1.0.0 postinstall /Users/luke/git/project/node_modules/ppx-env
bsb && cp lib/bs/native/ppx.native ppx-env

Error: spawnSync /Users/luke/git/project/node_modules/ppx-env/node_modules/bs-platform/lib/bsb.exe ENOENT
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! ppx-env@1.0.0 postinstall: `bsb && cp lib/bs/native/ppx.native ppx-env`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the ppx-env@1.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/luke/.npm/_logs/2018-07-12T20_04_12_189Z-debug.log
```

`package-lock.json` is supposed to make builds reproducible, so I don't understand what's causing this problem. Thank you for any advice or insight you may be able to provide.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện chuỗi ba lần cài đặt với package-lock.json và node_modules, sau đó kiểm tra các mục phụ thuộc của bs-platform, matchenv, reprocessing-scripts và ppx-env. Kiểm tra lệnh postinstall của ppx-env và đường dẫn còn thiếu bs-platform/lib/bsb.exe; được xem là hoàn tất khi các lần chạy npm i sạch, lặp lại đều nhất quán mà không xuất hiện ENOENT đã báo cáo hoặc các thay đổi bất ngờ trong lockfile.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
node.js, ocaml
Lĩnh vực
build-system, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.