mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-08 21:07:46 +00:00
When a project has a `.npmrc` containing `use-node-version`, package managers (notably `pnpm`) will download the specified Node.js version. This is not the correct way as it can lead to `pnpm` downloading Node.js 18 or newer which depends on a version of GLIBC that is not present in the current AWS image. The proper way is to set the `"engines"` in the `package.json`. <img width="468" alt="image" src="https://github.com/vercel/vercel/assets/97262/0974cf05-6a11-4d95-88e8-13affc4aad2a"> Discussion: https://github.com/orgs/vercel/discussions/2436
23 lines
733 B
TypeScript
Vendored
23 lines
733 B
TypeScript
Vendored
import { join } from 'path';
|
|
import { validateNpmrc } from '../src/validate-npmrc';
|
|
|
|
const fixture = (name: string) => join(__dirname, 'fixtures', '29-npmrc', name);
|
|
|
|
describe('validateNpmrc', () => {
|
|
it('should not error with no use-node-version', async () => {
|
|
await expect(validateNpmrc(fixture('good'))).resolves.toBe(undefined);
|
|
});
|
|
|
|
it('should throw when use-node-version is found', async () => {
|
|
await expect(
|
|
validateNpmrc(fixture('has-use-node-version'))
|
|
).rejects.toThrow('Detected unsupported');
|
|
});
|
|
|
|
it('should not error when use-node-version is commented out', async () => {
|
|
await expect(
|
|
validateNpmrc(fixture('comment-use-node-version'))
|
|
).resolves.toBe(undefined);
|
|
});
|
|
});
|