gulp serve 将返回此错误“文件不存在:C:\src\webparts\helloWorld\HelloWorldWebPart.manifest.json”

问题描述

当我运行以下命令时:-

const spotifyApi = await setUpSpotifyApi(userName);
await spotifyApi.getPlaylist(playlistId).then(
    (data) => {
      console.log('in spotify api call',data.body.tracks.items)
      trackList = data.body.tracks.items;
     // return data.body.tracks.items;
    },(err) => {
      console.log("Error grabbing playlist",err);
    }
  );
})

我会收到这个错误:-

C:\helloworld-webpart>gulp serve

enter image description here

有什么建议吗?

谢谢

解决方法

检查文件路径的大小写。请注意 config.json 中使用的大小写与文件系统中实际使用的大小写。在 Windows 机器上可能不是问题,但也许自动构建使用的是不同的操作系统,而这是一个问题?

例如,在您的具体示例中,引用的路径是: \helloWorld\HelloWorldWebPart.manifest.json

也许实际上是: \HelloWorld\HelloWorldWebPart.manifest.json

,

我想您尝试遵循 SPFx Microsoft 教程,但由于某种原因,该文件未生成。我在 VSCode 中生成了一个同名的 SPFx,并将复制文件文本结构为您生成它,如下所示:

{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json","id": "d0074c68-ef7e-4aba-9021-12b57f84aa4d","alias": "HelloWorldWebPart","componentType": "WebPart",// The "*" signifies that the version should be taken from the package.json
  "version": "*","manifestVersion": 2,// If true,the component can only be installed on sites where Custom Script is allowed.
  // Components that allow authors to embed arbitrary script code should set this to true.
  // https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
  "requiresCustomScript": false,"supportedHosts": ["SharePointWebPart"],"preconfiguredEntries": [{
    "groupId": "5c03119e-3074-46fd-976b-c60198311f70",// Other
    "group": { "default": "Other" },"title": { "default": "HelloWorld" },"description": { "default": "HelloWorld description" },"officeFabricIconFontName": "Page","properties": {
      "description": "HelloWorld"
    }
  }]
}

如果有效,请给我们反馈。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...