Scully: Could not connect to server

Created on 9 Jan 2020  ·  10Comments  ·  Source: scullyio/scully

🐞 Bug report

Description

First, thanks for your project, it's cool :-)

when running npm run scully, I'm getting this error:
Could not connect to server
I'm guessing this has something to do with the routes not being configured correctly in scully config

my routes looks like this (as an example)
https://cubesolver.app/tabs/home
https://cubesolver.app/tabs/guide/solving
https://cubesolver.app/tabs/guide/advanced/pll/u //where u is the ID

or from localhost:
http://localhost:4200/tabs/home
http://localhost:4200/tabs/guide/solving
http://localhost:4200/tabs/guide/advanced/pll/u

🔬 Minimal Reproduction

see also full app attached ....
my routing module look like this:
const routes: Routes = [
{ path: '', loadChildren: './tabs/tabs.module#TabsPageModule'},
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})

then TabsPageRoutingModule
const routes: Routes = [
{
path: 'tabs',
component: TabsPage,
children: [
{
path: '',
redirectTo: '/tabs/home',
pathMatch: 'full',
},
{
path: 'home',
children: [
{
path: '',
loadChildren: '../home/home.module#HomePageModule'
}
]
},
{
path: 'about',
children: [
{
path: '',
loadChildren: '../about/about.module#AboutPageModule'
}
]
},
{
path: 'guide',
children: [
{
path: '',
loadChildren: '../guide/guide.module#GuidePageModule'
}
]
}
,
{
path: 'editor',
children: [
{
path: '',
loadChildren: '../editor/editor.module#EditorPageModule'
}
]
}
]
},
{
path: '',
redirectTo: '/tabs/home',
pathMatch: 'full'
}
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class TabsPageRoutingModule {}

💻Your Environment

Angular Version:


C:\five\cubeSolver>ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.0.0-rc.8
Node: 12.14.0
OS: win32 x64

Angular: 9.0.0-rc.8
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker
Ivy Workspace: Yes

Package                                    Version
--------------------------------------------------------------------
@angular-devkit/architect                  0.802.2
@angular-devkit/build-angular              0.802.2
@angular-devkit/build-optimizer            0.802.2
@angular-devkit/build-webpack              0.802.2
@angular-devkit/core                       8.3.22
@angular-devkit/schematics                 8.3.22
@angular/pwa                               0.803.22
@ngtools/webpack                           8.2.2
@nguniversal/express-engine                8.2.6
@nguniversal/module-map-ngfactory-loader   8.2.6
@schematics/angular                        8.3.17
@schematics/update                         0.900.0-rc.8
rxjs                                       6.5.4
typescript                                 3.7.4
webpack                                    4.38.0

Scully Version:


"@scullyio/init": "0.0.9",
    "@scullyio/ng-lib": "latest",
    "@scullyio/scully": "latest",


🔥 Exception or Error




at the console, I'm getting 
The option outDir isn't configured, using default folder "C:\five\cubeSolver\dist\static\".
Cleaned up C:\five\cubeSolver\dist\static\ folder.
 ☺   new Angular build imported
started servers in background
Could not connect to server
npm ERR! code ELIFECYCLE
npm ERR! errno 15
npm ERR! [email protected] scully: `scully`
npm ERR! Exit status 15
npm ERR!
npm ERR! Failed at the [email protected] scully script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\yariv\AppData\Roaming\npm-cache\_logs\2020-01-09T01_09_35_914Z-debug.log

and the log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\yariv\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'scully'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prescully', 'scully', 'postscully' ]
5 info lifecycle [email protected]~prescully: [email protected]
6 info lifecycle [email protected]~scully: [email protected]
7 verbose lifecycle [email protected]~scully: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~scully: PATH: C:\Users\yariv\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\five\cubeSolver\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Perforce;C:\Program Files\Perforce\DVCS\;C:\Program Files\dotnet\;C:\Users\yariv\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\PuTTY\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Gradle\gradle-5.6\bin;C:\Users\yariv\AppData\Local\Android\Sdk\platform-tools;C:\Program Files\nodejs;c:\Python\python35;c:\Python\python35\scripts;C:\Program Files\nodejs\;C:\Users\yariv\.windows-build-tools\python27\;C:\ProgramData\Boxstarter;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Perforce;C:\Program Files\Perforce\DVCS\;C:\Program Files\dotnet\;C:\Users\yariv\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\PuTTY\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Users\yariv\AppData\Roaming\npm
9 verbose lifecycle [email protected]~scully: CWD: C:\five\cubeSolver
10 silly lifecycle [email protected]~scully: Args: [ '/d /s /c', 'scully' ]
11 silly lifecycle [email protected]~scully: Returned: code: 15  signal: null
12 info lifecycle [email protected]~scully: Failed to exec scully script
13 verbose stack Error: [email protected] scully: `scully`
13 verbose stack Exit status 15
13 verbose stack     at EventEmitter. (C:\Users\yariv\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:210:5)
13 verbose stack     at ChildProcess. (C:\Users\yariv\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:210:5)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\five\cubeSolver
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\yariv\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "scully"
18 verbose node v12.14.0
19 verbose npm  v6.12.1
20 error code ELIFECYCLE
21 error errno 15
22 error [email protected] scully: `scully`
22 error Exit status 15
23 error Failed at the [email protected] scully script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 15, true ]




I'm attaching the entire code for my app
just extract
cd cubesolver
npm i
ng serve

thanks very much
you're awesome

cubeSolver.zip

bug

Most helpful comment

I just ran into the same issue when running the examples from the docs.
I've run the application you provided, and was able to reproduce the same issue.

If you do npm run scully:serve instead of npm run scully you would run into an error like:

starting static server...
e Error: Multiple root routing modules found 
/Users/gerhardboer/Downloads/cubeSolver/src/app/app.module.ts, /Users/gerhardboer/Downloads/cubeSolver/src/app/guide/solving/advanced/advanced.module.ts, /Users/gerhardboer/Downloads/cubeSolver/src/app/guide/solving/basic/basic.module.ts

This is because you have routes in tabs.router.module that point to a folder outside the current folder.

{
        path: 'home',
          children: [
              {
                  path: '',
                  loadChildren: '../home/home.module#HomePageModule'
              }
          ]
      },

i had the same issue when generating a Router Module that got placed in its own subfolder.

a workaround would be to change all the paths to ./home/home.module#HomePageModule, so it doesn't go to a parent folder.
then of course you would have to place your modules inside the tabs folder to make it work.

I think this is actually an issue with guess.js/guess-parser, where i traced the issue from.

All 10 comments

I just ran into the same issue when running the examples from the docs.
I've run the application you provided, and was able to reproduce the same issue.

If you do npm run scully:serve instead of npm run scully you would run into an error like:

starting static server...
e Error: Multiple root routing modules found 
/Users/gerhardboer/Downloads/cubeSolver/src/app/app.module.ts, /Users/gerhardboer/Downloads/cubeSolver/src/app/guide/solving/advanced/advanced.module.ts, /Users/gerhardboer/Downloads/cubeSolver/src/app/guide/solving/basic/basic.module.ts

This is because you have routes in tabs.router.module that point to a folder outside the current folder.

{
        path: 'home',
          children: [
              {
                  path: '',
                  loadChildren: '../home/home.module#HomePageModule'
              }
          ]
      },

i had the same issue when generating a Router Module that got placed in its own subfolder.

a workaround would be to change all the paths to ./home/home.module#HomePageModule, so it doesn't go to a parent folder.
then of course you would have to place your modules inside the tabs folder to make it work.

I think this is actually an issue with guess.js/guess-parser, where i traced the issue from.

@SanderElias this error is the same we check this morning?

@gerhardboer , Thanks for the reply
indeed it was a routing issue
modifying the routes did not do the trick (unless I'm missing something).
However, I was able to move forward by converting the route to a flat one.

As the error from scully:serve suggested, I do use multiple routes.
changing this will require a major refactoring

So does scully support nested routes?
did I miss something? (configuration?)

Thanks and BR
Yariv

@yarivgdidi it should work with the relative routes and moving the modules inside the tabs/ folder.

As far as I can tell, it does work with multiple routes. The issue comes from an incorrect identification of root routes. This happens because of the ../ in the paths of the child routes.

@gerhardboer, where you able to do this with my app?
I did what you suggested and it didn't work.
I moved the nested routes under tab and fixed the paths moved the folders)
If you're convinced this should work, I can give it another try

I had a successful build with your app. I'm not able to show you at the moment, getting ready for bed 🥱 I can attach the project here tomorrow :)

@gerhardboer, @yarivgdidi This is indeed an issue with the guess-parser.
I'm going to replace the error with something more useful later today.
Our server needs to know the routes, so there is a catch-22 in there.

@yarivgdidi
attached you'll find the project
cubeSolver-changed-routes.zip
6a0120a85dcdae970b0128776ff992970c-pi
;)

I did a couple of PR's to make it more apparent what happens, so its easier to fix.
I'm going to close this issue, so we can center discussion in #40

I am messing around with this project. I am getting this guessjs error that we have seen before. @SanderElias do you know why it is happening?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

puku0x picture puku0x  ·  4Comments

Splaktar picture Splaktar  ·  6Comments

jorgeucano picture jorgeucano  ·  4Comments

kunjee17 picture kunjee17  ·  4Comments

msprogramando picture msprogramando  ·  5Comments