微信小程序构建npm时报错:NPM packages not found. Please confirm npm packages which need to build are belong to `miniprogramRoot` directory. Or you may edit project.config.json's `packNpmManually` and `packNpmRelationList`
- 如何配置
根据报错信息可以看出需要我们在project.config.json文件中指定构建npm相关的路径
如何配置
在project.config.json中添加如下代码(要加在setting下哦):
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./"
}
],
"packNpmManually": true,
添加完成后,再次点击【构建npm】,发现还是报错。
重点来了,这个时候要重启微信开发者工具,然后再次点击【构建npm】,就可以了