Skip to content

Error: ComponentName not found #234

@DonKirkham

Description

@DonKirkham

Description

When trying to generate a new solution, the cli fails with a "componentName is not defined" error.

Steps to reproduce

  1. run fnm i 22.20.0
  2. run npm i -g @microsoft/spfx-cli
  3. run spfx create --template-name webpart-react --library-name my-spfx-library --component-name "Hello World"

Expected behavior

Expectation is that solution is created in the current folder

Actual behavior

Received the following error message

Error creating SPFx component: config/config.json:5
    3|   "version": "2.0",
    4|   "bundles": {
 >> 5|     "<%= componentName.hyphen %>-web-part": {
    6|       "components": [
    7|         {
    8|           "entrypoint": "./lib/webparts/<%= componentName.camel %>WebPart/<%= componentName.pascal %>WebPart.js",

componentName is not defined

Error: config/config.json:5
    3|   "version": "2.0",
    4|   "bundles": {
 >> 5|     "<%= componentName.hyphen %>-web-part": {
    6|       "components": [
    7|         {
    8|           "entrypoint": "./lib/webparts/<%= componentName.camel %>WebPart/<%= componentName.pascal %>WebPart.js",

componentName is not defined

CLI version

0.1.0-pre.2 via npm ls -g (see below)

Node.js version

v22.20.0

Operating system

Windows

Template (if applicable)

all templates

Additional context

  • This was tested in PowerShell and WSL terminals. Same results in both.

  • I tested many (but not all) of the templates and received the same error each time.

  • Additionally: spfx --version gives the following error:

usage: spfx [-h] <command> ...
spfx: error: too few arguments
  • Previous version has similar error for componentName, but I didn't get it reported in time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions