sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

SPFX Local workbench not loading

Open silambarsan opened this issue 8 years ago • 38 comments

Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you.

Category

  • [ ] Question
  • [ ] Typo
  • [ ] Bug
  • [ ] Additional article idea

If you are planning to share a new feature request (enhancement / suggestion), please use SP Dev UserVoice at http://aka.ms/sp-dev-uservoice.

Expected or Desired Behavior

I have created a SPFX webpart as mentioned in the docs. Expected behaviour was to open the local workbench when I run gulp serve command. But Local workbench is not working. Earlier I had created few SPFX webparts, they were working fine. I had installed yo at dev level. Now I installed yo at global level

Observed Behavior

Local workbench page is loaded with Site can't be reached error message. Err_connection_reset

Steps to Reproduce

Create a SPFX webpart ( I am using node -v 6.10.2, yo sp generator -v 1.4.0, gulp -v 3.9.1) Run gulp trust-dev-cert Run gulp serve

Thanks for your contribution! Sharing is caring.

silambarsan avatar Jan 19 '18 13:01 silambarsan

Could you share the output of the gulp serve command? Which OS are you using?

waldekmastykarz avatar Jan 22 '18 15:01 waldekmastykarz

Hi,

I am using Windows 8.1. Please find below the gulp serve log

gulp serve Build target: DEBUG [16:26:52] Using gulpfile \HelloWorldSolution\gulpfile.js [16:26:52] Starting gulp [16:26:52] Starting 'serve'... [16:26:52] Starting subtask 'configure-sp-build-rig'... [16:26:52] Finished subtask 'configure-sp-build-rig' after 13 ms [16:26:52] Starting subtask 'spfx-serve'... Starting api server on port 5432. Registring api: /getwebparts Registring api: /. Registring api: /workbench [16:26:52] Finished subtask 'spfx-serve' after 525 ms [16:26:52] Starting subtask 'pre-copy'... [16:26:52] Finished subtask 'pre-copy' after 10 ms [16:26:52] Starting subtask 'copy-static-assets'... [16:26:52] Starting subtask 'sass'... [16:26:54] Server started https://localhost:4321 [16:26:54] LiveReload started on port 35729 [16:26:54] Opening https://localhost:5432/workbench using the default OS app [16:26:54] Finished subtask 'sass' after 1.72 s [16:26:54] Starting subtask 'tslint'... [16:26:55] Starting subtask 'typescript'... [16:26:55] [typescript] TypeScript version: 2.4.2 Warning: no-duplicate-case rule is deprecated. Replace your usage with the TSLint no-duplicate-switch-case rule. Warning: valid-typeof rule is deprecated. Replace your usage with the TSLint typeof-compare rule. [16:26:56] Finished subtask 'copy-static-assets' after 3.5 s [16:26:57] Finished subtask 'tslint' after 3.14 s [16:26:57] Finished subtask 'typescript' after 1.96 s [16:26:57] Starting subtask 'ts-npm-lint'... [16:26:57] Finished subtask 'ts-npm-lint' after 61 ms [16:26:57] Starting subtask 'api-extractor'... [16:26:57] Finished subtask 'api-extractor' after 1.94 ms [16:26:57] Starting subtask 'post-copy'... [16:26:57] Finished subtask 'post-copy' after 815 μs [16:26:57] Starting subtask 'collectLocalizedResources'... [16:26:57] Finished subtask 'collectLocalizedResources' after 20 ms [16:26:57] Starting subtask 'configure-webpack'... [16:26:58] Finished subtask 'configure-webpack' after 615 ms [16:26:58] Starting subtask 'webpack'... [16:27:00] Finished subtask 'webpack' after 1.79 s [16:27:00] Starting subtask 'configure-webpack-external-bundling'... [16:27:00] Finished subtask 'configure-webpack-external-bundling' after 1.44 ms [16:27:00] Starting subtask 'copy-assets'... [16:27:00] Finished subtask 'copy-assets' after 54 ms [16:27:00] Starting subtask 'write-manifests'... [16:27:00] Finished subtask 'write-manifests' after 584 ms [16:27:00] Starting subtask 'reload'... [16:27:00] Finished subtask 'reload' after 3.57 ms

Thank you. Regards, Silam

silambarsan avatar Jan 23 '18 11:01 silambarsan

Thanks for the output. Which browser are you using?

waldekmastykarz avatar Jan 24 '18 06:01 waldekmastykarz

I am using chrome [Version 63.0.3239.132 (Official Build) (64-bit)]. But I have tried the same with IE 11 & opera. Same result on all browsers.

Thank you.

silambarsan avatar Jan 24 '18 07:01 silambarsan

Could it be that you have a firewall enabled that could be blocking your connection?

waldekmastykarz avatar Jan 24 '18 09:01 waldekmastykarz

@silambarsan - Did you check your firewall? ERR_CONNECTION_RESET usually points to a network interface or firewall issue.

Are you able to navigate directly to https://localhost:4321?

iclanton avatar Feb 08 '18 19:02 iclanton

It looks like I'm having a similar issue.

@nickpape-msft for node v8 is there a workaround until the release? I tried the directions on Set up your SharePoint Framework development environment with node 8.9.4 on High Sierra, and the Hello World Guide

After I run gulp serve, i'm taken to https://localhost:5432/workbench via Chrome, but site can't be reached ERR_CONNECTION_CLOSED. @iclanton I can navigate to https://localhost:4321/ in which case I see a directory listing

Terminal output for gulp serve:

Build target: DEBUG
[13:58:58] Using gulpfile ~/dev/helloworld-webpart/gulpfile.js
[13:58:58] Starting gulp
[13:58:58] Starting 'serve'...
[13:58:58] Starting subtask 'configure-sp-build-rig'...
[13:58:58] Finished subtask 'configure-sp-build-rig' after 3.8 ms
[13:58:58] Starting subtask 'spfx-serve'...
Starting api server on port 5432.
Registring api: /getwebparts
Registring api: /*.*
Registring api: /workbench
[13:58:59] Finished subtask 'spfx-serve' after 183 ms
[13:58:59] Starting subtask 'pre-copy'...
[13:58:59] Finished subtask 'pre-copy' after 3.08 ms
[13:58:59] Starting subtask 'copy-static-assets'...
[13:58:59] Starting subtask 'sass'...
[13:58:59] Server started https://localhost:4321
[13:58:59] LiveReload started on port 35729
[13:58:59] Opening https://localhost:5432/workbench using the default OS app
[13:58:59] Finished subtask 'copy-static-assets' after 567 ms
[13:58:59] Finished subtask 'sass' after 560 ms
[13:58:59] Starting subtask 'tslint'...
[13:59:00] Starting subtask 'typescript'...
[13:59:00] [typescript] TypeScript version: 2.4.2
Warning: no-duplicate-case rule is deprecated. Replace your usage with the TSLint no-duplicate-switch-case rule.
Warning: valid-typeof rule is deprecated. Replace your usage with the TSLint typeof-compare rule.
[13:59:01] Finished subtask 'tslint' after 1.65 s
[13:59:01] Finished subtask 'typescript' after 1.03 s
[13:59:01] Starting subtask 'ts-npm-lint'...
[13:59:01] Finished subtask 'ts-npm-lint' after 4.78 ms
[13:59:01] Starting subtask 'api-extractor'...
[13:59:01] Finished subtask 'api-extractor' after 309 μs
[13:59:01] Starting subtask 'post-copy'...
[13:59:01] Finished subtask 'post-copy' after 127 μs
[13:59:01] Starting subtask 'collectLocalizedResources'...
[13:59:01] Finished subtask 'collectLocalizedResources' after 2.7 ms
[13:59:01] Starting subtask 'configure-webpack'...
[13:59:01] Finished subtask 'configure-webpack' after 138 ms
[13:59:01] Starting subtask 'webpack'...
[13:59:01] Finished subtask 'webpack' after 421 ms
[13:59:01] Starting subtask 'configure-webpack-external-bundling'...
[13:59:01] Finished subtask 'configure-webpack-external-bundling' after 413 μs
[13:59:01] Starting subtask 'copy-assets'...
[13:59:01] Finished subtask 'copy-assets' after 10 ms
[13:59:01] Starting subtask 'write-manifests'...
[13:59:02] Finished subtask 'write-manifests' after 180 ms
[13:59:02] Starting subtask 'reload'...
[13:59:02] Finished subtask 'reload' after 650 μs
^C[13:59:29] Server stopped
About to exit with code: 0
Process terminated before summary could be written, possible error in async code not continuing!
Trying to exit with exit code 1

package.json:

{
  "name": "helloworld-webpart",
  "version": "0.0.1",
  "private": true,
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "build": "gulp bundle",
    "clean": "gulp clean",
    "test": "gulp test"
  },
  "dependencies": {
    "@microsoft/sp-core-library": "~1.4.1",
    "@microsoft/sp-webpart-base": "~1.4.1",
    "@microsoft/sp-lodash-subset": "~1.4.1",
    "@microsoft/sp-office-ui-fabric-core": "~1.4.1",
    "@types/webpack-env": ">=1.12.1 <1.14.0"
  },
  "devDependencies": {
    "@microsoft/sp-build-web": "~1.4.1",
    "@microsoft/sp-module-interfaces": "~1.4.1",
    "@microsoft/sp-webpart-workbench": "~1.4.1",
    "gulp": "~3.9.1",
    "@types/chai": ">=3.4.34 <3.6.0",
    "@types/mocha": ">=2.2.33 <2.6.0",
    "ajv": "~5.2.2"
  }
}

Alek-S avatar Feb 16 '18 20:02 Alek-S

Using set NODE_NO_HTTP2=1 gulp serve Got it to work for me

LouFarho avatar Feb 16 '18 21:02 LouFarho

Hey,

Thanks for the quick reply.

Gave that a go but still no go for me on https://localhost:5432/workbench.

Did the following:

  1. Deleted node_modules folder
  2. Deleted package-lock.json file
  3. Added environmental variable for no http2 by putting export into my profile
-> printenv | grep NODE
NODE_NO_HTTP2=1
  1. Run npm install
  2. Run gulp serve

Get same ERR_CONNECTION_CLOSED. Maybe minimun version number for one of the microsoft modules needs to be bumped up in package.json file from above?

Build target: DEBUG
[15:47:00] Using gulpfile ~/dev/helloworld-webpart/gulpfile.js
[15:47:00] Starting gulp
[15:47:00] Starting 'serve'...
[15:47:00] Starting subtask 'configure-sp-build-rig'...
[15:47:00] Finished subtask 'configure-sp-build-rig' after 5.75 ms
[15:47:00] Starting subtask 'spfx-serve'...
Starting api server on port 5432.
Registring api: /getwebparts
Registring api: /*.*
Registring api: /workbench
[15:47:00] Finished subtask 'spfx-serve' after 313 ms
[15:47:00] Starting subtask 'pre-copy'...
[15:47:00] Finished subtask 'pre-copy' after 4.82 ms
[15:47:00] Starting subtask 'copy-static-assets'...
[15:47:00] Starting subtask 'sass'...
[15:47:01] Server started https://localhost:4321
[15:47:01] LiveReload started on port 35729
[15:47:01] Opening https://localhost:5432/workbench using the default OS app
[15:47:01] Finished subtask 'sass' after 660 ms
[15:47:01] Starting subtask 'tslint'...
[15:47:02] Starting subtask 'typescript'...
[15:47:02] [typescript] TypeScript version: 2.4.2
[15:47:02] Finished subtask 'copy-static-assets' after 1.42 s
Warning: no-duplicate-case rule is deprecated. Replace your usage with the TSLint no-duplicate-switch-case rule.
Warning: valid-typeof rule is deprecated. Replace your usage with the TSLint typeof-compare rule.
[15:47:03] Finished subtask 'tslint' after 1.91 s
[15:47:03] Finished subtask 'typescript' after 1.16 s
[15:47:03] Starting subtask 'ts-npm-lint'...
[15:47:03] Finished subtask 'ts-npm-lint' after 4.7 ms
[15:47:03] Starting subtask 'api-extractor'...
[15:47:03] Finished subtask 'api-extractor' after 259 μs
[15:47:03] Starting subtask 'post-copy'...
[15:47:03] Finished subtask 'post-copy' after 123 μs
[15:47:03] Starting subtask 'collectLocalizedResources'...
[15:47:03] Finished subtask 'collectLocalizedResources' after 2.48 ms
[15:47:03] Starting subtask 'configure-webpack'...
[15:47:03] Finished subtask 'configure-webpack' after 161 ms
[15:47:03] Starting subtask 'webpack'...
[15:47:03] Finished subtask 'webpack' after 584 ms
[15:47:03] Starting subtask 'configure-webpack-external-bundling'...
[15:47:03] Finished subtask 'configure-webpack-external-bundling' after 406 μs
[15:47:03] Starting subtask 'copy-assets'...
[15:47:03] Finished subtask 'copy-assets' after 11 ms
[15:47:03] Starting subtask 'write-manifests'...
[15:47:04] Finished subtask 'write-manifests' after 211 ms
[15:47:04] Starting subtask 'reload'...
[15:47:04] Finished subtask 'reload' after 885 μs
^C[15:48:43] Server stopped
About to exit with code: 0
Process terminated before summary could be written, possible error in async code not continuing!
Trying to exit with exit code 1

Alek-S avatar Feb 16 '18 22:02 Alek-S

I am curious as to what was updated to support NodeJS 8.9.4 I take it there wasn't something we needed to update on our end?

LouFarho avatar Feb 16 '18 22:02 LouFarho

Chrome 64 by default. Checked console didn't see any log or error messages, network shows failed status when trying to load. Also attempted Safari to similar effect. I'm gonna try again from home as a sanity check in case it's network related and report back.

screen shot 2018-02-16 at 4 51 43 pm

screen shot 2018-02-16 at 4 45 54 pm

Alek-S avatar Feb 16 '18 22:02 Alek-S

@nickpape-msft going directly to https://localhost:4321/temp/workbench.html works.

config/serve.json

{
  "$schema": "https://dev.office.com/json-schemas/spfx-build/config.2.0.schema.json",
  "version": "2.0",
  "bundles": {
    "hello-world-web-part": {
      "components": [
        {
          "entrypoint": "./lib/webparts/helloWorld/HelloWorldWebPart.js",
          "manifest": "./src/webparts/helloWorld/HelloWorldWebPart.manifest.json"
        }
      ]
    }
  },
  "externals": {},
  "localizedResources": {
    "HelloWorldWebPartStrings": "lib/webparts/helloWorld/loc/{locale}.js"
  }
}

Alek-S avatar Feb 16 '18 23:02 Alek-S

You're right, my mistake:

serve.json below

{
  "$schema": "https://dev.office.com/json-schemas/core-build/serve.schema.json",
  "port": 4321,
  "https": true,
  "initialPage": "https://localhost:5432/workbench",
  "api": {
    "port": 5432,
    "entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
  }
}

Alek-S avatar Feb 16 '18 23:02 Alek-S

so changing intialPage to temp/workbench.html assume is the fix then?

Alek-S avatar Feb 16 '18 23:02 Alek-S

Confirming that removing temp directory and running gulp serve generates the temp folder.

Alek-S avatar Feb 16 '18 23:02 Alek-S

Tested & confirmed working as expected with a new project on MacOS on High Sierra... no issues here.

  • MacOS: v10.13.3
  • SPFx: v1.4.1
  • Node.js: v8.9.2
  • NPM: v5.6.0

andrewconnell avatar Feb 16 '18 23:02 andrewconnell

Yeah corporate laptop. Heading home, will try there and on home comp.

Alek-S avatar Feb 17 '18 00:02 Alek-S

@nickpape-msft @andrewconnell I found the issue. Port 5432 is the default port value used by PostgreSQL databases, which I had running locally.

Shutting down the PostgreSQL service resolved the issue. screen shot 2018-02-16 at 7 57 34 pm

Alek-S avatar Feb 17 '18 02:02 Alek-S

@nickpape-msft I still need to set NODE_NO_HTTP2=1 What does one need to update to avoid this?

LouFarho avatar Feb 20 '18 21:02 LouFarho

@LouFarho New or existing project?

Assuming you've updated your project to v1.4.1, I'd suggest deleting your node_modules folder and reinstalling with npm install. Then give it a shot.

If still having issues, post the following in a follow-up:

  • contents of package.json in your project
  • result of node -v
  • version property of the file in node_modules/@microsoft/sp-build-core-tasks/package.json

To answer your question above, this is what changed and the only thing you need to do is update your project to SPFx v1.4.1. I added details on how to do this in my post picking apart v1.4.1.

andrewconnell avatar Feb 20 '18 22:02 andrewconnell