πŸ“– the

Good attitude, not so tired. In a good mood, all you see is beautiful scenery.

"If you can't solve a problem for a while, use this opportunity to see your limitations and put yourself out of order." As the old saying goes, it's easy to let go. If you are distracted by something, learn to disconnect. Cut out the paranoia, the trash in the community, and get rid of the negative energy. Good attitude, not so tired. In a good mood, all you see is beautiful scenery.

Today, let’s shareuni-appSeries (7) :uni-appCompile the reportcaniuse-lite is outdatedSome basic knowledge of the processing scheme, welcome to pay attention to!

Welcome to the summary series:The wild growth of UNI-APP learning path


πŸŒ‚caniuseCause of library expiration problem

Uni-app’s compiler is nPm-based and relies on a number of NPM libraries including MPvue and Webpack, which in turn reference a tripartite library called Caniuser-Lite.

The caniuser-Lite library has an update check for browser-compatible data in the code. If the data is too old, it will automatically complete the CSS prefix.

Developers usually don’t need to manually prefix browsers with CSS when writing uni-app, because the library does it automatically. The library itself expires every six months, and the following error occurs when it expires:

Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`
Copy the code

This alarm does not affect compilation success, but is an alarm

For developers familiar with NPM, this alarm should come as no surprise; just follow the command prompt to update it.

But many HBuilderX developers are not familiar with NPM and may not know what to do if they encounter problems. The available solutions are as follows:

Solution 1: UpgradeHBuilderX ζˆ– cli

Don’t use HBuilderX 6 months ago, or CLI, to keep upgrading. (Currently, the official HBuilderX version has not been updated in time, so it is overdue. It will be updated soon. The alpha version is normal.

Solution 2, in the old versionHBuilderXManual Upgradecaniuse-lite ηš„ npm εΊ“

If you don’t want to upgrade HBuilderX, you can fix the problem under the old version.

  • The project isHBuilderXTo create the
    • Open theHBuilderXInstallation directory of,HBuilderX/plugins/uniapp-cli

Remove node_modules and package-lock.json – execute NPM install in the current directory

  • If your project iscliCreated, please own incliUpgrade in the Environmentnpm εŒ…

Finally, thank you for your patience to watch the end, the original is not easy, six points like collection is your biggest encouragement to me!


πŸŽ‰ summary:

  • For more references, see here:The Blog of Chan Wing Kai

  • Like the small partner of the blogger can add a concern, a thumbs-up oh, continue to update hey hey!