mindee / doctr-tfjs-demo

Javascript demo of docTR, powered by TensorFlowJS
94 stars 20 forks source link

yarn build / yarn start give me Package subpath './lib/tokenize' is not defined by "exports" #62

Open CICCIOSGAMINO opened 1 year ago

CICCIOSGAMINO commented 1 year ago

I'm trying to install and run the project in environment with Yarn 1.3.2 and Node.js 19.7.0 but i get the error:

yarn run v1.3.2 $ react-scripts start node:internal/modules/cjs/loader:585 throw e; ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /home/ciccio/Downloads/toremove/doctr-tfjs-demo/node_modules/postcss-safe-parser/node_modules/postcss/package.json

bruno353 commented 1 year ago

I'm trying to install and run the project in environment with Yarn 1.3.2 and Node.js 19.7.0 but i get the error:

yarn run v1.3.2 $ react-scripts start node:internal/modules/cjs/loader:585 throw e; ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /home/ciccio/Downloads/toremove/doctr-tfjs-demo/node_modules/postcss-safe-parser/node_modules/postcss/package.json

Yeah, me too. Any solution?

alphabetaxz commented 1 year ago

Node.js 12 is ok

romainligneul commented 2 weeks ago

I managed to make it work with Node 18 with the following steps.

Install last versions of: npm install postcss postcss-safe-parser

Add to package.json:

{
  "exports": {
    "./lib/tokenize": "./lib/tokenize.js"
  }
}

Still in package.json add openssl legacy flags (not sure they are all needed, but at least for start)

  "scripts": {
    "start": "react-scripts --openssl-legacy-provider start",
    "build": "react-scripts --openssl-legacy-provider build",
    "test": "react-scripts --openssl-legacy-provider test",
    "eject": "react-scripts --openssl-legacy-provider eject"
  }