2016-12-09 17 views
0

我完成了https://dev.office.com/sharepoint/docs/spfx/web-parts/get-started/build-a-hello-world-web-part了HelloWorld的WebPart,並得到增強的Web部件連接到SharePoint以下https://dev.office.com/sharepoint/docs/spfx/web-parts/get-started/connect-to-sharepoint。在localhost中一切正常,但與我的開發者租戶無法連接到SharePoint(基本的HelloWorld webpart在那裏工作)。我無法與VS代碼調試,Node.js的&SPFX

我正在使用VSCode 1.7.2;節點6.5.0;殼牌1.3.8;和渲染器52.0.274382。

我產生如何使用Node.js和糾正 「方案」 的新launch.json: 「$ {workspaceRoot} \ SRC \的WebParts \ HelloWorld的\ HelloWorldWebPart.ts」

當我啓動程序,我得到:「 Can not lanch program ...;設置'outFiles'屬性可能有幫助。「

我輸入了「outFiles」:[「$ {workspaceRoot} \ lib \ webparts \ helloworld \ HelloWorldWebPart.ts」],但我仍然得到完全相同的錯誤。

接下來,我嘗試了附加到進程:首先我運行命令Tasks:Run Task;服務。這在Chrome中打開了本地主機頁面。然後我點擊Attach to Process。結果:「調試:附加到進程:無法連接到運行時進程,(超時,10000ms後)」。

我正在使用Azure Windows 10 VM。

非常感謝您的時間,精力和慷慨!!!

回答

0

從Office開發團隊這裏的官方文件: https://dev.office.com/sharepoint/docs/spfx/debug-in-vscode

我發現非常有用的文章在這裏: http://www.eliostruyf.com/how-to-debug-your-sharepoint-framework-web-part

我還創建了一個位置: http://blog.velingeorgiev.pro/how-debug-sharepoint-framework-webpart-visual-studio-code

吉斯特一起推出。 JSON配置在這裏: https://gist.github.com/VelinGeorgiev/4a7b77ced7198df0a3898420d46f3405

粘貼在這裏爲快速參考的配置:

// Use Chrome browser to debug SharePoint Framework React webpart with Visual Studio Code on Windows 
// - Install "Debugger for Chrome" extension 
// - Add this configuration to the launch.json 
// - Close all Chrome browser active instances 
// - Start the SPFx nodejs server by executing "gulp serve" 
// - Go to VS Code debug view (top menu -> View -> Debug) 
// - Hit the play (start debugging) button 
// Happy debugging! 
// Full guides 
// http://blog.velingeorgiev.pro/how-debug-sharepoint-framework-webpart-visual-studio-code 
// https://dev.office.com/sharepoint/docs/spfx/debug-in-vscode 
{ 
    "version": "0.2.0", 
    "configurations": [ 
     { 
      "name": "SPFx Local", 
      "type": "chrome", 
      "request": "launch", 
      "url": "https://localhost:4321/temp/workbench.html", 
      "webRoot": "${workspaceRoot}", 
      "sourceMaps": true, 
      "sourceMapPathOverrides": { 
       "webpack:///../../../../*": "${webRoot}/*", 
       "webpack:///../../../../src/*": "${webRoot}/src/*", 
       "webpack:///../../../../../src/*": "${webRoot}/src/*" 
      }, 
      "runtimeArgs": [ 
       "--remote-debugging-port=9222" 
      ] 
     }, 
     { 
      "name": "SPFx Online", 
      "type": "chrome", 
      "request": "launch", 
      "url": "https://<your_tenant>.sharepoint.com/sites/<your_site>/SitePages/<your_webpart_page>.aspx", 
      "webRoot": "${workspaceRoot}", 
      "sourceMaps": true, 
      "sourceMapPathOverrides": { 
       "webpack:///../../../../*": "${webRoot}/*", 
       "webpack:///../../../../src/*": "${webRoot}/src/*", 
       "webpack:///../../../../../src/*": "${webRoot}/src/*" 
      }, 
      "runtimeArgs": [ 
       "--remote-debugging-port=9222" 
      ] 
     }, 
     { 
      "name": "SPFx Online Workbench", 
      "type": "chrome", 
      "request": "launch", 
      "url": "https://<your_tenant>.sharepoint.com/_layouts/workbench.aspx", 
      "webRoot": "${workspaceRoot}", 
      "sourceMaps": true, 
      "sourceMapPathOverrides": { 
       "webpack:///../../../../*": "${webRoot}/*", 
       "webpack:///../../../../src/*": "${webRoot}/src/*", 
       "webpack:///../../../../../src/*": "${webRoot}/src/*" 
      }, 
      "runtimeArgs": [ 
       "--remote-debugging-port=9222" 
      ] 
     } 
    ] 
} 

請讓我知道如果任何問題。

相關問題