Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.2K
Vistas
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports"

I got this error when using uuidv4.

Failure: Package subpath './v4' is not defined by "exports" in C:\Users\mycomp\Desktop\Programming\Javascript\Serverless\Serverless Framework\node_modules\uuid\package.json
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports" in C:\Users\mycomp\Desktop\Programming\Javascript\Serverless\Serverless Framework\node_modules\uuid\package.json

I already installed uuid and require it in my code

const uuidv4 = require('uuid/v4');

Here's the package.json

"dependencies": {
  "aws-sdk": "^2.702.0",
  "moment": "^2.27.0",
  "serverless-offline": "^6.4.0",
  "underscore": "^1.10.2",
  "uuid": "^8.1.0"
}
over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

We had the same error with v1 uuid module (v8.3.2).

Solved this, adding following entry to exports section of installed uuid package.json(inside your node_modules):

"./v1": "./dist/v1.js"

Full export section of my projects' node_modules/uuid/package.json:

  "exports": {
    ".": {
      "node": {
        "module": "./dist/esm-node/index.js",
        "require": "./dist/index.js",
        "import": "./wrapper.mjs"
      },
      "default": "./dist/esm-browser/index.js"
    },
    "./package.json": "./package.json",
    "./v1": "./dist/v1.js"
  },

The problem remaining i now need to keep this modification across dist installs... :/

This could be fixed with a patch on uuid source itself?

EDIT: Didn't require the module in our own source. It is a dependency of jest (via some jest reporting sub-pkg).

EDIT: Alternatively, rolling back to uuid dep to v7.0.3 may fix this issue too, see comment below.

over 4 years ago · Santiago Trujillo Denunciar

0

Another option

const uuid = require('uuid');
uuid.v4(); // "c438f870-f2b7-4b2c-a1c3-83bd88bb1d79"
over 4 years ago · Santiago Trujillo Denunciar

0

ECMAScript Module syntax:

import { v4 as uuidv4 } from 'uuid';
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'

CommonJS syntax:

const { v4: uuidv4 } = require('uuid');
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda