When building npm, the error NPM packages not found. Please confirm npm packages …

When building npm, the error NPM packages not found. Please confirm npm packages which need to build are belong to miniprogramRoot directory…


This article introduces the method of "How to build npm for the WeChat Mini Program TS project".

Release time of this article: 2023.05.25

project environment

Windows10

npm9.6.7

WeChat Developer Tools Stable 1.06.2303220

TS WeChat Mini Program Project

error message

as shown in the picture
error message

Solution

  1. First, we create a TS project for a WeChat applet.
    1

  2. Right-click in the project directory - click [Open in an external terminal window]
    2

  3. In the cmd window that opens, enter the commandnpm init -y
    3

  4. Re-enter the commandnpm install
    4

  5. project.config.jsonAdd the following configuration to the file

        "packNpmManually": true,
        "packNpmRelationList": [
          {
          
          
            "packageJsonPath": "./package.json",
            "miniprogramNpmDistDir": "./miniprogram/"
          }
        ],
    

    5

  6. At this time, don't rush to click [Build npm], but click [Reopen this project] first.
    6

  7. Wait for the project to reopen, and then click [Build npm].
    7

  8. You can build successfully!
    8

Guess you like

Origin blog.csdn.net/qq_43492356/article/details/130863125
NPM