question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nx workspace: Could not find project "undefined" in 'angular.json'

See original GitHub issue

🐞 Bug report

Description

When creating a NX workspace and adding scully, starting it initially won’t work and leads to the error message Could not find project "undefined" in 'angular.json' (see full error message below).

🔬 Minimal Reproduction

1.) create a nx workspace with an angular app

npx create-nx-workspace scully-plugins
npx: installed 48 in 4.391s
✔ What to create in the new workspace · angular
✔ Application name                    · scully-plugin-demo
✔ Default stylesheet format           · css
✔ Use Nx Cloud? (It's free and doesn't require registration.) · No

2.) add a node library (this is maybe not necessary)

chore: add @nrwl/node
npx nx g @nrwl/node:lib scully-plugin-foo

3.) add scully as described in the scully docs

npm install @scullyio/init
nx g @scullyio/init:install -- --project=scully-plugin-demo

The file scully.scully-plugin-demo.config.ts has been created correctly

💻Your Environment

Angular Version:

nx version:


Angular CLI: 13.0.4
Node: 16.13.1
Package Manager: npm 8.1.2
OS: darwin x64

Angular: 13.0.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.4
@angular-devkit/build-angular   13.0.4
@angular-devkit/core            13.0.4
@angular-devkit/schematics      13.0.4
@angular/cli                    13.0.4
@schematics/angular             13.0.4
rxjs                            7.4.0
typescript                      4.4.4

Scully Version:


"@scullyio/init": "^2.0.5",
"@scullyio/ng-lib": "^2.0.0",
"@scullyio/scully": "^2.0.0",
"@scullyio/scully-plugin-puppeteer": "^2.0.0",

🔥 Exception or Error


npm run scully      

> scully-plugins@0.0.0 scully
> npx scully --

  ⚠ 
      =====================================================================================================
      Config file "./scully.undefined.config.ts" not found, only rendering routes without parameters
      The config file should have a name that is formated as:
          scully.<projectName>.config.ts
      where <projectName> is the name of the project as defined in the 'angular.json' file
      If you meant to build a different project as undefined you can use:
          --project differentProjectName as a cmd line option

      When you are in a mixed mono-repo you might need to use the --pjFirst flag.
       which will look for package.json instead of angular.json to find the 'root' of the project.
    =====================================================================================================

  x Could not find project "undefined" in 'angular.json'.

Running npx scully --pjFirst will lead to the same result.

Handing over the config file explicitely will work:

npx scully --cf scully.scully-plugin-demo.config.ts

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
TatyanaMolchanovacommented, Aug 30, 2022

Could not find project “undefined” in ‘angular.json’.

The right solutions is here!!!

in angular.json add in the root of the object: “defaultProject”: “my-blog”,

{ “$schema”: “./node_modules/@angular/cli/lib/config/schema.json”, “version”: 1, “newProjectRoot”: “projects”, “defaultProject”: “my-blog”, “projects”: { “my-blog”: { “projectType”: “application”, “schematics”: { “@schematics/angular:component”: { “style”: “scss” } },

And name the scully file as scully.my-blog.config.ts

0reactions
morenoisidrocommented, Oct 1, 2022

Same here. Thanks @TatyanaMolchanova .

Read more comments on GitHub >

github_iconTop Results From Across the Web

NX The angular.json file is out of sync · Issue #9414 - GitHub
Hi! So in Nx 13+ there should be no projects inside nx.json, and the key itself shouldn't be present. Any project-specific props ...
Read more >
Angular.json Invalid in Nx Workspace - Stack Overflow
I recently migrated a usual Angular Application into an Nx Workspace. Badly, I always get an error when trying to run any command...
Read more >
nx cannot read properties of undefined (reading 'endswith')
I encount this issue a lot of times. Just remove the ".cache/nx" folder in your node_modules and re-run your command. Open side panel....
Read more >
nrwl-nx/community - Gitter
I'm trying to debug an application that uses a library, and I'm not hitting breakpoints in the library in vscode. The angular.json looks...
Read more >
Schematics for libraries - Angular
In your library project's package.json file, add a "schematics" entry with the path to your schema file. The Angular CLI uses this entry...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found