Search code examples
node.jsnpmnpm-scriptsnpm-starteris

Error: [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/rest/RequestHandler' is not defined by /node_modules/eris/package.json


So i'm really new to this type of stuff. When running my 'npm start' command, it keeps dropping the following error below:

[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/rest/RequestHandler' is not defined by "exports" in /root/InviteManagerV2/node_modules/eris/package.json

I've looked up the error many times and 'deleting all the files and reinstalling' didn't work, neither did a update. Do you guys have any idea on how i can fix this? Any help would be great!

Here is my startup script:

    "scripts": {
        "start": "cross-env NODE_ENV=dev node scripts/dev-run.js",
        "debug": "cross-env NODE_ENV=dev node scripts/dev-run.js debug",
        "build": "tsc",
        "lint": "tslint --project tsconfig.json --config tslint.json --format stylish",
        "format": "prettier --write \"src/**/*.ts\" \"docs/**/*.md\" \"README.md\" \"CHANGELOG.md\"",
        "release": "npm run build && npm run docs && npm run format && standard-version",
        "i18n": "node scripts/check-i18n.js",
        "nxv": "node ./scripts/npm-exact-versions.js",
        "docs": "node scripts/generate-docs.js"
    },


Solution

  • Use this

    1. install a npm package env-cmd [package documentation][1]

      npm install env-cmd

    2. make a folder in root directory of project, name it as config and create a file in it called as dev.env

    3. Define your environment variables in this dev.env for eg PORT=3000

    4. then add this line to your package.json file

      "start ": "env-cmd -f ./config/dev.env node scripts/dev-run.js"