简体   繁体   中英

DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at node_modules\postcss\package.json

Since I upgraded Node to version 16, I started noticing this when I build my Angular app.

DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at "...\node_modules\postcss\package.json".

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

Is there a way to fix this without downgrading the Node version?

Regarding the GitHub issue, this one is recurrent one:

https://github.com/postcss/postcss/issues/1455#issuecomment-872240742

An update of postcss should do the job.

Solution:

  1. Go to defined location C:\<xampp>\htdocs\<projName>\node_modules\tslib\package.json .
  2. At exports field - replace this "./": "./" to "./": "./*" .

我正在使用节点 16 切换回 14 并开始工作。

I suffered from the same issue but into tslib package
I tried updating version by version till this version 2.4.0 now everything works correctly

Take a look at your package.json and check if you have --prod flag in the build script, if so update it for --configuration production

That will solve the issue, too

Try with this:

Go to node_modules\postcss\package.json

swap out "./": "./" with "./*": "./"

The best way to fix this is to downgrade to a lower version of Node. But not doing a reinstall of Node.

Install NVM - Node version manager. That way you can have multiple versions of Node at the same time. For each project, you will be able to switch to a specific Node version you want. It can be found at https://github.com/coreybutler/nvm-windows

Go to your client directory in your project and npm i postcss.

This should fix it!

Thanks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM