Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Create a new theme - failed #106

Closed
ranga-tolapi opened this issue Jun 25, 2021 · 17 comments
Closed

Create a new theme - failed #106

ranga-tolapi opened this issue Jun 25, 2021 · 17 comments
Assignees
Labels
bug Something isn't working

Comments

@ranga-tolapi
Copy link

Creation of a new theme is failing

Description

image

Expected Behavior

Actual Behavior

NestedError: Cannot copy `preview/`: the file doesn't exist
    at C:\Users\rt89280\AppData\Roaming\npm\node_modules\@arcgis\cli\node_modules\cpy\index.js:96:10
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5) {
  nested: undefined,
  name: 'CpyError'

Possible Fix

Steps to Reproduce

  1. arcgis styles create my-custom-theme

Context

Your Environment

  • Version used: 4.19.0
  • Browser Name and version: N.A.
  • Operating System and version (desktop or mobile): Microsoft Windows 10 Pro (laptop)
  • Link to your project if available:
@ranga-tolapi
Copy link
Author

ranga-tolapi commented Oct 7, 2021

Any update on this issue please.

@jcfranco

@collarch
Copy link

I have the same issue by the way, looking for a solution!

@jcfranco
Copy link
Member

Apologies for the delay. I'll look into this next week.

@mikael-mansson
Copy link

Would highly appreciate this update @jcfranco

@instantgis
Copy link

instantgis commented Nov 19, 2021

I needed this in a hurry! So I debugged through the code and fond a work around/ugly hack that may work for others too...
Copy folder preview here and its contents (index.html) to .arcgis-js-cli-styles where the base styles are copied by the tool in the target project.
You will still have a problem with import @esri/calcite-components/dist/calcite/calcite in _core.scss - not found!
npm install --save @esri/calcite-components
Then copy @esri/calcite-components from node_modules to .arcgis-js-cli-styles/base
Now you can preview and play

Here are the exact steps...

D:\Projects\Verizon\styling\verizon-theme>arcgis styles create verizon
copying base
copying examples
copying preview file
arcgis styles create [theme]

Create a custom theme

Positionals:
  theme  the name of the theme to create   [string] [default: "my-custom-theme"]

Options:
      --version        Show version number                             [boolean]
  -e, --with-examples  when specified, the created theme will include examples
                       from the API                                    [boolean]
  -b, --with-base      when specified, the created theme will include base files
                       for local overrides (advanced)                  [boolean]
  -f, --force          overwrites a theme if it already exists         [boolean]
  -h, --help           Show help                                       [boolean]

NestedError: Cannot copy `preview/`: the file doesn't exist
    at C:\Users\alain\AppData\Roaming\npm\node_modules\@arcgis\cli\node_modules\cpy\index.js:96:10
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5) {
  nested: undefined,
  name: 'CpyError'
}

Bombs out no joy right?

D:\Projects\Verizon\styling\verizon-theme>arcgis styles preview verizon
no available themes to preview, use the create command to create a theme

No previews either because it bombed! Relax fear not ... copy preview folder as indicated above and run it again.

D:\Projects\Verizon\styling\verizon-theme>arcgis styles preview verizon
compiling verizon
failed to build theme Error: Can't find stylesheet to import.
   ╷
81 │ @import "@esri/calcite-components/dist/calcite/calcite";
   │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  .arcgis-js-cli-styles\base\_core.scss 81:9  @import
  verizon\main.scss 9:9                       root stylesheet

Now its missing @esri/calcite-components/dist/calcite/calcite

So npm install it "somewhere" and plop it in as indicated above.

And now....

D:\Projects\Verizon\styling\verizon-theme>arcgis styles preview verizon
compiling verizon
compiled theme successfully
launching preview, use CTRL+C to terminate
[Browsersync] Access URLs:
 ---------------------------------------------
       Local: http://localhost:3000/preview
    External: http://172.21.144.1:3000/preview
 ---------------------------------------------
          UI: http://localhost:3001
 UI External: http://localhost:3001
 ---------------------------------------------
[Browsersync] Serving files from: D:\Projects\Verizon\styling\verizon-theme\.arcgis-js-cli-styles
[Browsersync] Watching files...

Yeah, joy :)

@instantgis
Copy link

Its failing to copy preview here in src/commands/styles/scaffold.ts

await cpy('preview/', buildPath(`${workspacePath}/<preview>`, dirs), {
	cwd: buildPath(`<dirname>/../../`, dirs),
});

No idea why. Because of the trailing / on cpy ?

@ranga-tolapi
Copy link
Author

ranga-tolapi commented Dec 7, 2021

I have found a workaround 😊

Step-1: (Need to perform only one time)

  • Copy preview folder
    from %AppData%\npm\node_modules\@arcgis\cli\dist\
    to %AppData%\npm\node_modules\@arcgis\cli\

Step-2: (Need to perform on each new style)

  • npm install --save @esri/calcite-components
  • copy @esri/calcite-components folder
    from node_modules
    to .arcgis-js-cli-styles\base

@jcfranco jcfranco self-assigned this Jan 10, 2022
@jcfranco jcfranco added the bug Something isn't working label Jan 10, 2022
@jcfranco
Copy link
Member

I finally had some time and submitted a PR for this. I'm sorry it took so long to get to it.

Thank you all for sharing your workarounds and additional error info, it was most helpful.

jcfranco added a commit that referenced this issue Jan 10, 2022
@jcfranco
Copy link
Member

Installed. This should be available in the next release. cc @odoe

@claesjs
Copy link

claesjs commented Jan 21, 2022

@jcfranco Do you have an ETA on the next release?

@odoe
Copy link
Collaborator

odoe commented Jan 21, 2022

i'll do a patch update later today

@ranga-tolapi
Copy link
Author

Issue persist with version 4.22.1

image

@odoe
Copy link
Collaborator

odoe commented Jan 22, 2022

Thanks, we'll need to some debugging on Windows, thanks.

@claesjs
Copy link

claesjs commented Jan 25, 2022

I'm getting the same error on Mac, arcgis version 4.22.1.

Screenshot 2022-01-25 at 15 48 13

The problem seems to be that arcgis-js-api is located on the same level as @arcgis, i.e. in node_modules. If I read the log output correctly is seems like @arcgis looks for arcgis-js-api in its own node_modules directory.

@jcfranco jcfranco assigned odoe and unassigned jcfranco Aug 4, 2022
@sfabijanski
Copy link

I'm on Linux (Fedora 35), with version 4.23.0 of the CLI tool. Using Node v16.14.2. I just experienced the missing preview copy error mentioned above.

arcgis styles create my-theme -e
image

@Tlepel
Copy link

Tlepel commented Jul 28, 2023

I tried to find why the second fault , the failed import @import "@esri/calcite-components/dist/calcite/calcite"; didn't work, and I found out that changing it to @import "@esri/calcite-components/dist/calcite/calcite.css"; actually solved that part of the problem.

@andygup
Copy link
Member

andygup commented Jan 26, 2024

Closing this issue in preparation for deprecation of the library.

@andygup andygup closed this as completed Jan 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants