Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at G:\SNWS\sn-micro-front-web-project-template\node_modules\postcss\package.json. #1455

Closed
LP1994 opened this issue Nov 5, 2020 · 58 comments · Fixed by #1456

Comments

@LP1994
Copy link

LP1994 commented Nov 5, 2020

This is not a error!!!

operating system: Windows 10,
node: 15.1.0,
npm: 6.14.8,
webpack: 5.4.0,
postcss: 8.1.4

This is only a warning issued by "nodejs". It is recommended to make corrections according to the warning, because some writing methods are not recommended.

image

@ShenHongFei
Copy link
Contributor

fixed in this PR
#1456

@ai
Copy link
Member

ai commented Nov 5, 2020

The fix was released in 8.1.5.

@ai ai reopened this Nov 5, 2020
@ai
Copy link
Member

ai commented Nov 5, 2020

@ShenHongFei just replacing ././* cause an issue in Node.js 12.

Can we fix this warning by adding ./ and ./* together in package.json→exports?

@ShenHongFei
Copy link
Contributor

@ShenHongFei just replacing ././* cause an issue in Node.js 12.

Can we fix this warning by adding ./ and ./* together in package.json→exports?

Yes, that works.

@ai
Copy link
Member

ai commented Nov 6, 2020

How I can see this warning?

@ai
Copy link
Member

ai commented Nov 8, 2020

@LP1994 what do I need to call to see this warning?

@LP1994
Copy link
Author

LP1994 commented Nov 9, 2020

@LP1994 what do I need to call to see this warning?

These warnings appear only after upgrading to the following versions:
"postcss": "8.1.6",
"webpack": "5.4.0",
"npm": "6.14.8",
"node": "15.1.0",
operating system: Windows 10

@ai
Copy link
Member

ai commented Nov 10, 2020

Another way to fix the problem 92155c7

@ai
Copy link
Member

ai commented Nov 10, 2020

Nope, this way again kills Node.js 15 in CommonJS.

Can you create a small test repo?

@LP1994
Copy link
Author

LP1994 commented Nov 10, 2020

Nope, this way again kills Node.js 15 in CommonJS.

Can you create a small test repo?
Later, I'll try.

@borodadada
Copy link

Hello. I have DeprecationWarning

(node:29624) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at D:\js\project\web\node_modules\css-loader\node_modules\postcss\package.json.
Update this package.json to use a subpath pattern like "./*".
webpack built bb7b669f975520d3919d in 8025ms
i 「wdm」: Hash: bb7b669f975520d3919d
Version: webpack 4.44.2

@DopamineDriven
Copy link

I too have a deprecation warning, using postcss 8.2.1
nodejs 15.4
nextjs v 10.03

$ yarn dev
yarn run v1.22.5
$ next -p 3434
Loaded env from C:\Users\Anthr\drisdell-consulting-services\.env.local
Loaded env from C:\Users\Anthr\drisdell-consulting-services\.env
(node:12964) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Users\Anthr\drisdell-consulting-services\node_modules\next\node_modules\postcss\package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
ready - started server on http://localhost:3434
(node:12964) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Users\Anthr\drisdell-consulting-services\node_modules\postcss\package.json.
Update this package.json to use a subpath pattern like "./*".

@ozbigcat
Copy link

The current "solution" by changing "./": "./" to "./*": "./*" (or adding "./*": "./*") did remove the warning, but it breaks the program on certain functionality.

However, if I reading this correctly, according to:
https://nodejs.org/api/packages.html#packages_subpath_exports

shouldn't the change be "./*": "./*.js" ?
I have tried it and it works..but of course, need a more thorough test,

Here is a small repository to reproduce the current warning (pending the solution)
https://github.com/ozbigcat/postcss-1455-deprecation-warning

My environment:
Windows 10
Node 15.3.0
npm 7.1.0
autoprefixer 10.1.0
postcss 8.2.1
postcss-cli 8.3.1
tailwindcss 2.0.2

@ozbigcat
Copy link

Uh, just found a case where "./*": "./*.js" also did not work.
In this case, it tries to look for a 'package.json.js' which is not valid name... happy to go back to the warning... :-(

@JR2Media
Copy link

Having this problem. Also using tailwind, postcss, autoprefixer and gulp. No idea how to solve it.

Is this an error in one of the packages I'm using? It's only a warning at this point so I'm not terribly concerned but I am confused at the error message.

@Colorin09
Copy link

Colorin09 commented Jan 10, 2021

Hello, I was wondering if someone got a solution for that issue, i am having the same issue and replacing with "./*" only breaks other postcss imports in the lib directory (updating to vers. 8.0.0 did not resolve the issue :/)

Edit: I was using node.js version 15.5.1

@divvjson
Copy link

I'm facing the same warning. I'm on node 15.5.1 with postcss 8.2.4

@Colorin09
Copy link

Colorin09 commented Jan 11, 2021

I managed to fix the problem by downgrading to node.js 14.15.1, maybe it will work for you,
I couldn't find exactly what was the error, updating autowriter and postcss libraries did not work for my case:/

@ignat
Copy link

ignat commented Jun 17, 2021

I see this warning with:

  • node 16.3.0
  • postcss 8.3.5

It appears that next comes with its own postcss dependency version.

@youssef-aitali
Copy link

@k4y4k update PostCSS to the latest version. We fixed this bug in Node.js 16

this worked for me!

@vitoneto
Copy link

vitoneto commented Sep 3, 2021

This was happening to me!
I was using node v16 i just change to node v14 and the error message stoped and the compilation works very well.

@armordog
Copy link

armordog commented Oct 21, 2021

This seems to be back for node 17.x.
Building on Vercel Heroku
node 17.0.1
postcss 8.3.10

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser' is not defined by "exports" in C:\gitl\web-apps
\node_modules\next\node_modules\postcss\package.json

I assume this is the same problem because under node 16.x I see the deprecation error at the same place.

Triloworld added a commit to Triloworld/sanity-module that referenced this issue Oct 30, 2021
ERROR  (node:69269) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Volumes/Dane/Repozytoria/osklad.pl/node_modules/@nuxtjs/sanity/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)

Node: v16.11.1
NPM: 8.0.0

It is compatible with Node v12 as this state: postcss/postcss#1455 (comment)
@ramdaniAli
Copy link

ramdaniAli commented Nov 23, 2021

excuse me but I have the same problem with react 17 but I don't have PostCSS in my packages so it's a sub-dependency or ... ? if so
how can you update PostCSS it in a porjet made with create-react-app ?

@ai
Copy link
Member

ai commented Nov 23, 2021

@ramdaniAli yeap, check you lock file. Today postcss can be found in nested dependencies of most of front-end projects.

For instance, css-loader uses PostCSS.

@ramdaniAli
Copy link

@ai looks like my project is using this version of postcss "^7.0.32" .
normally i can't just do npm install postCSS, so how can I safely update it ?

@ai
Copy link
Member

ai commented Nov 23, 2021

There is no way to do it in CRA. You should do eject and avoid using CRA in the future since this project is abandoned.

@ramdaniAli
Copy link

create react app is still maintained by facebook (meta) , but they have like 1k issues ,
Btw , there is no one who has already used create react app and fixed this problem ?

@ai
Copy link
Member

ai commented Nov 23, 2021

create react app is still maintained by facebook (meta) , but they have like 1k issues ,

They can’t update PostCSS from 7 to 8 for year. It is only big framework, which didn’t update it.

Just look lack of response and solutions in their issues about PostCSS 8.

@ramdaniAli
Copy link

ok, I see, in any case, thank you for the quick answers @ai .

last thing, dou you have any idea which package uses postCSS ? or some tips on how I can detect it ?

Im working on a project with theses packages :

  "dependencies": {
    "@date-io/date-fns": "^2.11.0",
    "@date-io/moment": "^2.11.0",
    "@emotion/react": "^11.4.1",
    "@emotion/styled": "^11.3.0",
    "@mui/icons-material": "^5.0.0",
    "@mui/lab": "^5.0.0-alpha.52",
    "@mui/material": "^5.0.0",
    "@mui/styled-engine-sc": "^5.0.0",
    "@mui/styles": "^5.0.1",
    "@mui/x-data-grid": "^5.0.0-beta.7",
    "@react-spring/parallax": "^9.3.0",
    "@react-spring/web": "^9.3.0",
    "@reduxjs/toolkit": "^1.6.1",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "aos": "^2.3.4",
    "apexcharts": "^3.28.3",
    "axios": "^0.22.0",
    "date-fns": "^2.25.0",
    "formik": "^2.2.9",
    "framer-motion": "^4.1.17",
    "material-ui-image": "^3.3.2",
    "moment": "^2.29.1",
    "notistack": "^2.0.2",
    "react": "^17.0.2",
    "react-apexcharts": "^1.3.9",
    "react-dom": "^17.0.2",
    "react-hook-form": "^7.17.0",
    "react-icons": "^4.3.1",
    "react-lazy-load-image-component": "^1.5.1",
    "react-loader-spinner": "^4.0.0",
    "react-parallax": "^3.3.0",
    "react-redux": "^7.2.5",
    "react-reveal": "^1.2.2",
    "react-router-dom": "^5.3.0",
    "react-scripts": "4.0.3",
    "react-spring": "^9.3.0",
    "react-useanimations": "^2.0.6",
    "redux": "^4.1.1",
    "redux-devtools-extension": "^2.13.9",
    "redux-thunk": "^2.3.0",
    "redux-watch": "^1.2.0",
    "styled-components": "^5.3.1",
    "stylis": "^4.0.10",
    "stylis-plugin-rtl": "^2.1.1",
    "swiper": "^7.0.8",
    "web-vitals": "^0.2.4",
    "workbox-background-sync": "^5.1.3",
    "workbox-broadcast-update": "^5.1.3",
    "workbox-cacheable-response": "^5.1.3",
    "workbox-core": "^5.1.3",
    "workbox-expiration": "^5.1.3",
    "workbox-google-analytics": "^5.1.3",
    "workbox-navigation-preload": "^5.1.3",
    "workbox-precaching": "^5.1.3",
    "workbox-range-requests": "^5.1.3",
    "workbox-routing": "^5.1.3",
    "workbox-strategies": "^5.1.3",
    "workbox-streams": "^5.1.3",
    "yup": "^0.32.9"
  },
 "devDependencies": {
    "babel-plugin-import": "^1.13.3",
    "customize-cra": "^1.0.0",
    "react-app-rewired": "^2.1.8",
    "snyk": "^1.769.0"
  }

@ramdaniAli
Copy link

ramdaniAli commented Nov 23, 2021

looks like the issue is from react-scripts 😭

here is the full report :

image

@k4y4k
Copy link

k4y4k commented Nov 23, 2021

@ramdaniAli yarn why will tell you why you have a package. e.g. yarn why react

@sostenesapollo
Copy link

stills in node v16.13.0

@ramdaniAli
Copy link

@ramdaniAli yarn why will tell you why you have a package. e.g. yarn why react

@k4y4k thank you for the tip but unfortunately, it doesn't help, because postcss is a sub-dependency , so it's not in my package.json but on my yarn.lock file

@sostenesapollo Yes Im on node v16.13.0 , if I downgrade the version I would no longer have the error? afterwards, that doesn't necessarily solve the problem but Its good for me xD , so any idea which is the most recent version of node where we do not have this problem ?

@k4y4k
Copy link

k4y4k commented Nov 25, 2021

@ramdaniAli yeah. I know. that's how you find why things are installed if you didn't ask for them. That's why I gave you that tip, so you could find 'why'.

Your original message was

last thing, dou you have any idea which package uses postCSS ? or some tips on how I can detect it ?

So there's your 'tip on how to detect it'.

@kenatjh
Copy link

kenatjh commented Jun 22, 2023

this is open source, no solve

@arprinceofficial
Copy link

(node:6112) [DEP0155] DeprecationWarning: Use of deprecated trailing slash pattern mapping "./" in the "exports" field module resolution of the package at D:\Github Projects\emasbd\emasbd_frontend\node_modules\flowbite-vue\package.json imported from D:\Github Projects\emasbd\emasbd_frontend\node_modules. Mapping specifiers ending in "/" is no longer supported.
(Use node --trace-deprecation ... to show where the warning was created)

(node:6112) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving "./dist//index.mjs" for module request ".//index.mjs" matched to "./*" in the "exports" field module resolution of the package at D:\Github Projects\emasbd\emasbd_frontend\node_modules\flowbite-vue\package.json imported from D:\Github Projects\emasbd\emasbd_frontend\node_modules.

pls help me for getting this warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.