Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './public/extractFiles' is not defined by "exports" in

Viewed 3110

I got the following error after running a docker image that I built

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './public/extractFiles' is not defined by "exports" in /app/node_modules/apollo-upload-client/node_modules/extract-files/package.json

the following is my Dockerfile:

`FROM node:17.1.0

WORKDIR /app

COPY package.json ./ COPY package-lock.json ./

COPY ./ ./ RUN npm install

CMD [ "npm", "start" ]`

I don't know if it is a node.js version problem, so I tried to change the version, but always I got the same problem. Any help please

1 Answers

same problem here.

In my case this was raised due to old npm package dependencies.

extract-files Version 7 uses a deprecated node function:

(node:2520) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./public/" in the "exports" field module resolution of the package at ...\node_modules\extract-files\package.json.

Node 17 raises this error you posted.

Possible Solutions:

  1. Update extract-files package to latest
  2. Use Node 16.x

Bonus tip:

since you´re copying package-lock.json you can run

npm ci

instead of npm install. Its faster and made for CI/CD pipelines

Related