Skip to content
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

Scully fail to make pages - plugin "storeRoutes has thrown the below error, #1630

Open
boskiv opened this issue Dec 6, 2022 · 7 comments
Open
Labels
bug Something isn't working

Comments

@boskiv
Copy link

boskiv commented Dec 6, 2022

🐞 Bug report

Description

πŸ”¬ Minimal Reproduction

πŸ’»Your Environment

Angular Version:


➜  git:(master) βœ— nx --version
15.3.0

Scully Version:


"@scullyio/ng-lib": "^2.1.41",
"@scullyio/scully": "^2.1.41",
"@scullyio/scully-plugin-puppeteer": "^2.1.41",

πŸ”₯ Exception or Error


➜  git:(master) βœ— npx scully --pr docs --scanRoutes
  ⚠ Folder "./scully" doesn't seem to contain custom plugins
  x Could not find project "docs" in 'angular.json'.
  βœ” new Angular build files imported
  βœ” Starting servers for project "docs"
  βœ” Started Scully static server on "http://localhost:1668/"
  βœ” Started Angular distribution server on "http://localhost:1864/" 
  βœ” Scully Development Server is up and running
  βœ” Puppeteer is being launched
  βœ” Successfully scanned Angular app for routes
  βœ” Successfully added routes created from routePlugins
  x  The scullySystem plugin "storeRoutes has thrown the below error,
              while trying to render route "unknown"
              Scully will exit
  x TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
                                               %                                                                                                                                                               ➜  


import { ScullyConfig } from '@scullyio/scully';
import '@scullyio/scully-plugin-puppeteer';

const defaultPostRenderers = ['seoHrefOptimise'];

export const config: ScullyConfig = {
  projectRoot: './apps/docs/src',
  projectName: 'docs',
  distFolder: './dist/apps/docs',
  outDir: './dist/docs-static',
  routes: {},
  defaultPostRenderers,
  target: 'targets',
  puppeteerLaunchOptions: {
    args: ['--no-sandbox'],
  },
};
@boskiv boskiv added the bug Something isn't working label Dec 6, 2022
@djmcgrath101
Copy link

Also experiencing this same issue on Nx version 15.4.5

@maximegris
Copy link

maximegris commented Feb 14, 2023

@boskiv @djmcgrath101
I managed to make the script working by adding the key sourceRoot with the same value as projectRoot in my scully config file. (My project is with Nx : 15.6.3)

This is what just showed me the way

storeRoutes.ts line 16

const srcFile = join(scullyConfig.homeFolder, scullyConfig.sourceRoot, routesFileName); // wrong path generated when sourceRoot is not set

@spaceribs
Copy link

@maximegris this worked for me as well πŸ‘ thank you!

@FanYeeChok
Copy link

storeRoutes.ts

@boskiv @djmcgrath101 I managed to make the script working by adding the key sourceRoot with the same value as projectRoot in the scully config file. (My project is with Nx : 15.6.3)

storeRoutes.ts line 16

const srcFile = join(scullyConfig.homeFolder, scullyConfig.sourceRoot, routesFileName); // wrong path generated when sourceRoot is not set

hi @maximegris , may i know where is storeRoutes.ts ?

@maximegris
Copy link

Hi @FanYeeChok

The file is here

@FanYeeChok
Copy link

I see, that means modify existing scully code? anyway, i tot you mention sourceRoot, so i add the sourceRoot at scully.web-showroom.config.ts and its working fine.

e.g.

export const config: ScullyConfig = {
  projectRoot: "./apps/web-showroom/src",
  projectName: "web-showroom",
  distFolder: './dist/apps/web-showroom',
  sourceRoot: "./apps/web-showroom/src",
  spsModulePath: 'YOUR OWN MODULE PATH HERE',
  outDir: './dist/static',
  defaultPostRenderers: [Http404Plugin,'seoHrefOptimise', baseHrefRewrite],
  target: 'targets',
  // handle404: ['', 'index', 'baseOnly', '404', 'none'],
  handle404: 'index',
  routes: {
  }
};

@maximegris
Copy link

maximegris commented Jun 30, 2023

@FanYeeChok Yes it was by adding sourceRoot in your own Scully config, not by modifying the Scully code :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants