Azure Maps PCF控件构建报错[pcf-1014]:缺少manifest属性
问题描述
开发Azure Maps PCF控件,需求包括:
- 绑定Dataverse的address_autofill字段
- 实现地址输入自动补全
- 选中地址后在Azure Map上标记
- 启用保存按钮触发PreOperation插件获取地址
- 优雅处理错误
遇到的问题:
- 执行
npm run build时抛出**[pcf-1014]**错误:Manifest validation problem: instance requires property "manifest" - 执行
npm run refreshTypes时出现TypeError: Cannot read properties of undefined (reading 'control'),无法生成IInputs和IOutputs
已尝试的操作:
npm run clean→npm run refreshTypes- 删除生成文件与out文件夹
- 新建PCF控件并复制现有内容
提供的配置文件如下:
ControlManifest.Input.xml
<?xml version="1.0" encoding="utf-8"?> <control namespace="RR" constructor="AzureMapsAddressAutofill" version="1.0.1" display-name-key="Azure Maps Address Autofill" description-key="Azure Maps Address Autofill PCF" control-type="standard"> <property name="address" display-name-key="Address" description-key="Address Autofill" of-type-group="SingleLine.Text" usage="bound" required="true" /> <resources> <code path="index.ts" order="1" /> <css path="css/AzureMaps.css" order="1" /> </resources> </control>
package.json
{ "name": "azuremapsaddressautofill-control", "version": "1.0.1", "description": "Azure Maps Address Autofill PCF Control", "scripts": { "build": "pcf-scripts build", "clean": "pcf-scripts clean", "refreshTypes": "pcf-scripts refreshTypes" }, "dependencies": { "pcf-scripts": "^1" }, "pcf": { "manifest": "ControlManifest.Input.xml" } }
pcfconfig.json
{ "outDir": "out", "schema": "1.0.1", "controls": { "AzureMapsAddressAutofill": { "manifest": "ControlManifest.Input.xml" } }, "namespace": "RR" }
解决方案
1. 统一PCF工具版本并修复配置文件结构
问题根源大概率是pcf-scripts版本不兼容,以及配置文件的字段结构不符合当前工具要求。
步骤1:锁定pcf-scripts到稳定版本
将package.json中的pcf-scripts依赖从^1改为具体稳定版(如1.18.4,PCF工具链常用稳定版本),同时添加pcf-start依赖:
"dependencies": { "pcf-scripts": "1.18.4", "pcf-start": "1.18.4" }
执行命令重新安装依赖:
npm install
步骤2:调整pcfconfig.json结构
新版PCF工具链不再需要controls和namespace字段,直接指定manifest路径即可,修改后的文件:
{ "outDir": "out", "schema": "1.0.1", "manifest": "ControlManifest.Input.xml" }
步骤3:移除package.json中的冗余pcf字段
新版工具链不再读取package.json中的pcf配置,直接删除该字段:
{ "name": "azuremapsaddressautofill-control", "version": "1.0.1", "description": "Azure Maps Address Autofill PCF Control", "scripts": { "build": "pcf-scripts build", "clean": "pcf-scripts clean", "refreshTypes": "pcf-scripts refreshTypes" }, "dependencies": { "pcf-scripts": "1.18.4", "pcf-start": "1.18.4" } }
2. 重新执行构建流程
完成配置修改后,依次执行以下命令:
npm run clean npm run refreshTypes npm run build
3. 验证Manifest文件合法性
确保ControlManifest.Input.xml完全符合PCF schema要求:
- 检查所有标签是否正确闭合(当前manifest已满足)
- 确认
control-type设置为standard是正确的 - 验证资源路径与实际文件位置匹配(
index.ts在根目录、css/AzureMaps.css存在于css文件夹)
补充排查点
如果问题仍未解决,检查以下内容:
- 本地Node.js版本是否为16.x或18.x(PCF工具链支持的LTS版本)
- 清除npm缓存避免旧版本干扰:
npm cache clean --force
内容的提问来源于stack exchange,提问作者Pratik Soni
相关产品推荐
相关产品推荐

