Skip to content

Builds Don't Work with PostCSS After Update #11565

Closed

Description

@kanto2113

In Node v17:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /tmp/workspace/node_modules/postcss-safe-parser/node_modules/postcss/package.json

In earlier versions of Node, this was just a deprecation warning:

Update this package.json to use a subpath pattern like "./*".

Activity

  1. shallow-alchemy commented on Oct 23, 2021

    @shallow-alchemy

    I'm experiencing the same issue

  2. dantman commented on Oct 23, 2021

    @dantman

    This is related to postcss/postcss-safe-parser#29. Which is actually entirely CRA's fault because react-scripts@4.0.3 is using PostCSS 7 (obsolete) and an old version of postcss-safe-parser.

    It looks like the work fixing this issue was already merged in July (PostCSS was updated to version without this Node 17 issue in #11121, and postcss-safe-parser was removed in #11201). However none of that has been released yet. All of that is being pushed to CRA v5, however I don't see anything in the 5.0 milestone that should in any way block a CRA 5.0 release.

  3. heymike777 commented on Oct 23, 2021

    @heymike777

    Is there any fix for this?

  4. vnva commented on Oct 24, 2021

    @vnva

    @Timashov, rolling back to Node 16.8.0 helped me.

  5. experimatt commented on Oct 24, 2021

    @experimatt

    @kanto2113 @dantman thank you for documenting this issue. I'm in the exact same boat, and am eagerly awaiting a possible solution.

  6. shallow-alchemy commented on Oct 25, 2021

    @shallow-alchemy

    Nuked my node modules and yarn.lock and ran yarn install and it worked. Using cra typescript template.

  7. ValeriMladenov commented on Oct 26, 2021

    @ValeriMladenov

    Just remove yarn.lock & node_modules & run yarn

  8. FelicitusNeko commented on Oct 26, 2021

    @FelicitusNeko

    The solution of removing yarn.lock and node_modules does not work for me. I get a large number of these errors, and Yarn fails:

    ➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
        at new NodeError (node:internal/errors:371:5)
        at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
        at PassThrough.emit (node:events:390:28)
        at emitCloseNT (node:internal/streams/destroy:145:10)
        at processTicksAndRejections (node:internal/process/task_queues:82:21)
    
  9. shallow-alchemy commented on Oct 26, 2021

    @shallow-alchemy

    @FelicitusNeko what version of node are you on?

  10. FelicitusNeko commented on Oct 26, 2021

    @FelicitusNeko

    @MatthewPardini I switched to Node 17.0.1 using NVM and gave it a try. No good. Also, this is using Yarn 3.0.2.

  11. komali2 commented on Oct 27, 2021

    @komali2

    Having this issue, wiping out node_modules didn't work, the only solution that's worked for me is nvm use 16.8.0.

  12. shivamdave22 commented on Nov 1, 2021

    @shivamdave22

    Package subpath './lib/parser' is not defined by "exports" in /home/node/app/node_modules/postcss/package.json I am getting an error like this today suddenly.

  13. 27 remaining items

  14. melleveapp commented on Feb 17, 2022

    @melleveapp

    i downgraded version node, and worked

  15. rjcallahan commented on Mar 2, 2022

    @rjcallahan

    npm audit fix --force also fixed this issue for me

  16. zeelz commented on Apr 25, 2022

    @zeelz

    My node was 17.0. Had to get LTS nvm install lts

    If you don't have nvm:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
    source ~/.nvm/nvm.sh

  17. added a commit that references this issue on Apr 30, 2022
  18. Konglomneshued commented on Jan 14, 2023

    @Konglomneshued

    Can we get a real fix and not downgrading Node version? Current LTS is now 18.13.0.

  19. atwellpub commented on Feb 17, 2023

    @atwellpub

    I was receiving Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser' is not defined by "exports" in ...node_modules\next\node_modules\postcss\package.json

    I have resolved it on node version 17.4.0 after I upgraded react, and nextjs using: npm install react@latest react-dom@latest npm install next@12

    (https://nextjs.org/docs/upgrading)

    This worked for me

  20. ayansome1 commented on May 2, 2023

    @ayansome1

    Upgrading should solve your issue:
    https://nextjs.org/docs/upgrading

    npm i next@latest react@latest react-dom@latest eslint-config-next@latest
    # or
    yarn add next@latest react@latest react-dom@latest eslint-config-next@latest
    # or
    pnpm up next react react-dom eslint-config-next --latest
    
  21. appfliiq-x commented on May 30, 2023

    @appfliiq-x

    I used these commands to deploy to production on Vercel. Simply insert it in the "Install Command" field.
    Rename your yarn.lock or package.lock files ending with -backup from github repo just incase of anything.

    npm install next@12 && npm install react@latest react-dom@latest && npm i --package-lock-only && yarn install && npm audit fix --force

  22. moomoo-dev commented on Jul 5, 2023

    @moomoo-dev

    Was this ever fixed?

  23. moomoo-dev commented on Jul 5, 2023

    @moomoo-dev

    Ok so I actually got pass this issue but updating to postcss": "8.2.12"

  24. foverokavindz commented on Aug 31, 2023

    @foverokavindz

    npm audit fix --force

    this works for me

  25. sahumanika commented on Oct 12, 2023

    @sahumanika

    Yes, it works for me too.

  26. rphcompany commented on Jun 11, 2024

    @rphcompany

    I was receiving Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser' is not defined by "exports" in ...node_modules\next\node_modules\postcss\package.json

    I have resolved it on node version 17.4.0 after I upgraded react, and nextjs using: npm install react@latest react-dom@latest npm install next@12

    (https://nextjs.org/docs/upgrading)

    Worked for me as well.

  27. added a commit that references this issue on Nov 23, 2024
  28. davidrajm commented on Nov 30, 2024

    @davidrajm

    Downgrading the node version to 16.8.0 only sorted out the issue event in end of 2024.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions