Comments (8)
Nice finding of @pkerschbaum https://docs.npmjs.com/cli/v9/using-npm/scripts#npm-rebuild
npm` rebuild
preinstall
install
postinstall
prepare
prepare is only run if the current directory is a symlink (e.g. with linked packages)
which exactly explains our issue, because we have a symlink there (in the nature of pnpm)
from uuid.
Closing for the time being, as I'm not able to reproduce the issue (see below). npm rebuild
, yarn rebuild
, and pnpm rebuild
all run without issue for me. So I'm suspicious this is something specific to your environment. But feel free to put up a test case that allows us to reproduce the problem and I'll reopen.
That said... there does seem to be something to this. I think you / we are falling afoul of some combination of poor documentation and deprecated behavior in npm
. The npm build
command used to be a thing, but support and documentation for it was quietly dropped after npm@6
. Yet npm rebuild
is spec'ed as "runs the npm build
command" is still a thing. I've opened this discussion to see what the npm
folks have to say.
Regardless, where this project is concerned I don't think we're relying on the built-in interpretation of build
. Our versionwent in 3 years ago and is only used for generating the products we bundle when publishing the package. (Which means renaming this to postinstall
would not be appropriate, btw.)
$ pwd
/tmp
$ mkdir foo
$ cd foo
$ npm init -y
Wrote to /private/tmp/foo/package.json:
<...snip>
$ npm install uuid
added 1 package, and audited 2 packages in 394ms
found 0 vulnerabilities
$ npx pnpm --version
7.27.1
$ npx pnpm rebuild
$
$ npm rebuild
rebuilt dependencies successfully
$
$ npm rebuild --ignore-scripts
rebuilt dependencies successfully
$
from uuid.
are you sure it's about the build script and not about the prepare script?
The weird thing I thought is the reason is that sometimes it seems the prepare script is even run on install. See https://docs.npmjs.com/cli/v9/using-npm/scripts
NOTE: If a package being installed through git contains a prepare script, its dependencies and devDependencies will be installed, and the prepare script will be run, before the package is packaged and installed.
It seems somehow it assumes that it is a git package in my environment I guess? Or what do they try us to say with this note?
The commands i run:
$ pnpm i
$ pnpm deploy --prod --filter package ./output
Copy the whole Output inside a docker alpine image (it contains the node_modules folder)
Run npm rebuild inside docker.
Maybe it's caused by another dependency that uses UUID, i will look into that tomorrow.
Regarding prepare and postinstall I have to agree though, I'm not sure what brought me to this suggestion 🙈
from uuid.
I think that NOTE only applies when pulling a module directly from a git repo. E.g. if you had the uuid
dependency in package.json declared as "uuid": "git+https://github.com/uuidjs/uuid.git"
.... which I assume isn't the case here.
from uuid.
One small update:
we have issues with other prepare steps too, so somehow npm thinks it needs to run the prepare hooks in our setup. Ppbl a npm bug though, will let you know if we create a bug report over at npm for it.
from uuid.
Interesting. I guess the assumption there is that symlinks reference local / unpublished modules. E.g. as you'd get with npm link
or yarn
workspaces.
Note: In my test, above I used npm
to install uuid
, which doesn't create a symlink. But even if I use pnpm
for the install (and, thus, create a symlink) pnpm rebuild
still works for me:
$ npx pnpm init
...
$ npx pnpm install uuid
...
$ ls -lF node_modules/uuid
lrwxr-xr-x 1 kieffer wheel 34 Mar 20 09:25 node_modules/uuid@ -> .pnpm/[email protected]/node_modules/uuid
$ npx pnpm rebuild
$
from uuid.
Try to run npm rebuild
instead.
pnpm rebuild
without arguments is not working in our tests, it doesn't rebuild all packages / does nothing at all, it looks like it needs a positional argument to specify packages to rebuild, but haven't looked closer and it yet.
from uuid.
regarding pnpm rebuild
I created this issue: pnpm/pnpm#6268
from uuid.
Related Issues (20)
- [BUG] Broken imports on browser builds HOT 3
- [BUG] UUID validator identifies uuid as invalid HOT 3
- How to check if UUID v5 was generated with a specific namespace?
- Double spaces in the deprecation message HOT 1
- Vulnerable dependencies (indirect security issues) HOT 2
- NPM Deprication Message is ambiguous HOT 2
- Question: Do we still need it?
- Sponsored issue: Incremental UUID HOT 1
- [BUG] uncorrect validation uuid HOT 1
- [question] is posible decode uuid to data back ? HOT 1
- Add UUID type to use in TypeScript HOT 1
- validate method returns false for a valid UUID HOT 6
- Issue in the import statement HOT 1
- [BUG] Installing `uuid` has an inconsistent dependency chain causing build issues in ci/cd pipelines HOT 2
- uuidv6 has been officially adopted by the IETF HOT 3
- Tracking Issue: RFC 9562 / uuid@10 HOT 1
- Make `Uint8Array` the one and only type used for binary (byte) uuid values
- Drop support for `offset` argument, commit to `Uint8Array` type for binary uuids
- Add v8 Support HOT 1
- Port codebase to TypeScript HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uuid.