Skip to content

Commit

Permalink
[fix] Downgrade npm for Git submodule support
Browse files Browse the repository at this point in the history
`npm install` used to `git clone --recursive` the things that it builds out of GitHub; but it [doesn't do that anymore](npm/cli#2774). Unfortunately, we depend on that feature, because a submodule is how https://github.com/Level/rocksdb pulls in the Facebook code.

This fixes a really absconse error message, which is a huge pain to debug BTW:

```
npm ERR! make: *** No rule to make target 'Release/obj.target/rocksdb/deps/rocksdb/rocksdb/cache/cache.o', needed by 'Release/obj.target/deps/rocksdb/rocksdb.a'.  Stop.
```

(That's because there's no source code under `deps/rocksdb/rocksdb`, on account of that directory being a Git submodule.)

It seems... difficult to convince npm to keep its temporary files for inspection. I had to temporarily push a hacked `package.json` into the `master` branch of `epfl-si/rocksdb-node`, with an `install` script entry that reads

```
    "install": "node-gyp-build || (sleep 3600; exit 1)",
```

Confusingly enough, modern `npm`s will do the right thing (i.e. pull the submodules) when one runs e.g. `npm i -g epfl-si/rocksdb-node`; but not when said `epfl-si/rocksdb-node` is a dependency in a `package.json`, as is the case here. Go figure.
  • Loading branch information
Dominique Quatravaux committed Feb 28, 2023
1 parent 04755c1 commit d1ca562
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM node:18-alpine AS common

# SIGH. https://github.com/npm/cli/issues/2774
RUN npm install -g npm@'^6.4.11'

WORKDIR /app

COPY package*.json ./
Expand Down

0 comments on commit d1ca562

Please sign in to comment.