Encounter problems
miniprogram_npm
When the vant component was introduced into the mini program, a folder was not found in the directory , resulting in vant not being introduced successfully.
Solution
vant introduce half, try,
Build npm first, then continue to introduce vant
Sure enough, after building npm, miniprogram_npm
the folder was generated and vant was introduced successfully.
Found out later
In the applet project, it is generated miniprogram_npm目录
by using commands. npm install
This directory stores third-party dependent libraries installed through npm.
To upgrade the mini program version and automatically generate the miniprogram_npm directory, you can follow the steps below :
- Make sure there is a valid file in your applet project directory
package.json
.npm init
If not, you can create a new file by executing in the project root directorypackage.json
. - .In the project
根目录下执行命令npm install
, this will install the required third-party packages into the node_modules directory based on the dependency list in the package.json file. - In the mini program development tool, click in the menu bar
“工具”-“构建 npm”
, which will automaticallynode_modules
copy the dependencies in to the directory under the root directory of the mini programminiprogram_npm
. - After confirming
miniprogram_npm
that the directory has been generated, you can use the third-party library installed through npm in the applet code.
tips
Please note that this is required after each npm install 重新执行一次“构建 npm”
to copy the latest dependencies into miniprogram_npm
the directory.