Admins will be upgrading ORNL GitLab Servers on Saturday, 16 May 2026, from 7 AM until 11 AM EST. Repositories will experience intermittent outages during this time.
## Tool specific instructions {#javascript-tool-specific}
### buildNpmPackage {#javascript-buildNpmPackage}
`buildNpmPackage` allows you to package npm-based projects in Nixpkgs without the use of an auto-generated dependencies file (as used in [node2nix](#javascript-node2nix)). It works by utilizing npm's cache functionality -- creating a reproducible cache that contains the dependencies of a project, and pointing npm to it.
*`npmDepsHash`: The output hash of the dependencies for this project. Can be calculated in advance with [`prefetch-npm-deps`](#javascript-buildNpmPackage-prefetch-npm-deps).
*`makeCacheWritable`: Whether to make the cache writable prior to installing dependencies. Don't set this unless npm tries to write to the cache directory, as it can slow down the build.
*`npmBuildScript`: The script to run to build the project. Defaults to `"build"`.
*`npmFlags`: Flags to pass to all npm commands.
*`npmInstallFlags`: Flags to pass to `npm ci`.
*`npmBuildFlags`: Flags to pass to `npm run ${npmBuildScript}`.
echo'Hint: set `npmBuildScript`, override `buildPhase`, or set `dontNpmBuild = true`.'
echo
exit 1
fi
if! npm run "$npmBuildScript"$npmBuildFlags"${npmBuildFlagsArray[@]}"$npmFlags"${npmFlagsArray[@]}";then
echo
echo'ERROR: `npm build` failed'
echo
echo"Here are a few things you can try, depending on the error:"
echo"1. Make sure your build script ($npmBuildScript) exists"
echo'2. If the error being thrown is something similar to "error:0308010C:digital envelope routines::unsupported", add `NODE_OPTIONS = "--openssl-legacy-provider"` to your derivation'
echo" See https://github.com/webpack/webpack/issues/14532 for more information."