-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not connect to server #40
Comments
Can you give me more info? |
I get the same error in the scully branch of this repo: I'm trying to get scully working in an nx monorepo, so maybe there's some hard-coded path that is expecting a default Angular CLI set up? yarn run v1.19.1
$ scully
Cleaned up /Users/isaac/Documents/code/nx-monorepo-sample/dist/static/ folder.
☺ new Angular build imported
started servers in background
Could not connect to server
✨ Done in 17.08s. |
Could be related to lazy-loading routes with tsconfig path aliases.
And {
path: 'home',
loadChildren: () => import('@ng-cli-app/home/ui').then(m => m.HomeUiModule),
canActivate: [AuthGuard]
}, |
Possibly related to #31 as I saw this first before I saw the extra info from the errors in that issue. Update: They appear to be separate issues as that issue isn't seeing any problems with reading the routes. |
Oops, I missed the first line of getting started that says you need Angular 9.x. I'll upgrade and report back |
I've updated that repo to angular 9 and am still getting the same error. I think guess is having trouble with the lazy loaded routes. I added a var collectRoutingModules = function (root, registry, result, parentPath, currentPath) {
if (parentPath === void 0) { parentPath = root; }
if (currentPath === void 0) { currentPath = ''; }
console.log('root', root);
var declaration = registry[root];
var process = function (r) {
if (r.module) { And modified exports.traverseAppRoutes = async (appRootFolder = config_1.scullyConfig.projectRoot) => {
try {
const routes = guess_parser_1.parseAngularRoutes(appRootFolder).map(r => r.path);
return routes;
}
catch (e) {
console.log('e',e)
throw new Error('Scully could not traverse routes');
}
}; And this is what shows up when I run
|
This line |
* watch(fix): fix manual restart * watch(fix): fix watchmode for angular build * watch(fix): fix angular build watch * feat(scully): get support for error message get support for error message when scully kill the app * fix(scully): rewrite watch mode change all from the watch mode for support the new config, and some hotfix fix #57 #40 * fix(fsfolder): fix how to read the routes config * fix(sccully): remove old code
could be a problem with host (like at angular cli). I had the same. I created a feature request for this: If you try to manually change the host here in your node_modules, does it work then?
Do you have an alternative host then localhost on your machine? |
I had the same issue, I thought the problem was the port It seems like C:\Users\tdeschryver\dev\throw-aways\bloggy\node_modules\.bin\scully:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at Module._compile (internal/modules/cjs/loader.js:872:18)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
at Function.Module._load (internal/modules/cjs/loader.js:703:12)
lala at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
at internal/main/run_main_module.js:17:11 The next time I run scully the express servers are not spawned because the port is already in use. I would have expected this error to be caught by https://github.com/scullyio/scully/blob/master/scully/utils/staticServer.ts#L64, but this is not the case. By listening to errors, the error showed me that the port was already in use.
After I modified the port to another port (in the I think not swallowing these errors and logging them might be useful, For spawned processes:
For express:
Environment:
|
@isaacplmann @vsavkin here is a workaround for nx monorepo compatibility issue |
@isaacplmann yes, the Guess.js parser @chrisguttandin did some work towards support for Nx monorepos for his |
Hi everyone, the changes that I made to guess-parser a while ago to support nx monorepos were related to that line: https://github.com/guess-js/guess/blob/master/packages/guess-parser/src/angular/index.ts#L50. It is using TypeScript's own module resolution and should therefore respect path prefixes like Right now I don't know of any issues related to nx monorepos when using angular-prerender. But that does of course not guarantee that there are none. :-) I hope this somehow helps. |
@mgechev is there a new version of guess-parser released that includes this fix? |
@SanderElias yes, 0.4.12 includes the fix. |
I opened a PR to handle path mappings in lazy routes here. The integration test is from the repro that @isaacplmann provided. Feel free to check this out and tell me if it solves the main problem. |
don't know why but started facing the same
|
I was still having exactly the same problems, but was able to get it working by removing an error check in guess-parser. In my case, I found that the issue was that the guess parser was complaining about multiple root routing modules.
I'm not sure why it doesn't like my routes, I only have one root routing module with 'forRoot'. I was able to get it running by commenting out the error check in the relevant function in
The commented out portion is what I modified. It then worked as the first in the array is my root module. However, it still doesn't work with just Thoughts? |
@oleosjo there's another fix that I didn't release yet. Just pushed it in version 0.4.13. |
any update on import('@yeti/home').then(module => module.HomeModule),
// import('../../../../libs/home/src/lib/home.module').then(module => module.HomeModule), ng build
npx scully
npx lite-server |
@xmlking in import('@yeti/blog').then(module => module.BlogModule) from: import('../../../blog/src/lib/blog.module').then(
module => module.BlogModule
) And everything should work as expected. If you look at
None of these files exist. I'll detect this earlier in Guess.js and throw an error when the resolved file does not exit. |
@mgechev not related to this issue but, I noticed the following error while using typescript
|
@mgechev I changed as you suggested , still getting error. "resolutions": {
"guess-parser": "^0.4.13"
} latest changes are on Github, when you get a chance for testing ng build
npx scully
|
{
path: 'blog',
loadChildren: () =>
import('../../../blog/src/lib/blog.module').then(module => module.BlogModule)
} |
…t connect This pr adds a better handling when we fail to traverse routes in the angular app, and explains the most common reasons. closes #40
@xmlking I wasn't able to reproduce the route parsing error when using path mapping. For me things keep working with Folks who hit the parsing error can directly report to https://github.com/guess-js/guess with a repro. |
Sorry to bring this issue back, may be this issue is related to my env
|
@xmlking also make sure you're using the latest release of Guess.js. I released yesterday. |
Im in an nx repo and i was not able to find a solution above. Although im not sure this is caused by NX incompatibility cause sometimes it works and others it doesnt. Maybe someone can advise? cmd
outputscully Config
ng routing file
env
|
🐞 bug report
Description
Tried running scully on an angular 9 app, got an error.
🔬 Minimal Reproduction
Run scully
💻Your Environment
Angular CLI: 9.0.0-rc.6
Node: 12.8.1
OS: darwin x64
🔥 Exception or Error
The text was updated successfully, but these errors were encountered: