arcgis-js-cli icon indicating copy to clipboard operation
arcgis-js-cli copied to clipboard

Create a new theme - failed

Open ranga-tolapi opened this issue 4 years ago • 15 comments

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 avatar Jun 25 '21 08:06 ranga-tolapi

Any update on this issue please.

@jcfranco

ranga-tolapi avatar Oct 07 '21 02:10 ranga-tolapi

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

collarch avatar Oct 22 '21 19:10 collarch

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

jcfranco avatar Oct 23 '21 00:10 jcfranco

Would highly appreciate this update @jcfranco

mikael-mansson avatar Nov 12 '21 13:11 mikael-mansson

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 avatar Nov 19 '21 16:11 instantgis

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 ?

instantgis avatar Nov 19 '21 17:11 instantgis

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

ranga-tolapi avatar Dec 07 '21 08:12 ranga-tolapi

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 avatar Jan 10 '22 22:01 jcfranco

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

jcfranco avatar Jan 10 '22 23:01 jcfranco

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

claesjs avatar Jan 21 '22 08:01 claesjs

i'll do a patch update later today

odoe avatar Jan 21 '22 16:01 odoe

Issue persist with version 4.22.1

image

ranga-tolapi avatar Jan 22 '22 05:01 ranga-tolapi

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

odoe avatar Jan 22 '22 16:01 odoe

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.

claesjs avatar Jan 25 '22 14:01 claesjs

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

sfabijanski avatar Sep 21 '22 15:09 sfabijanski

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.

Tlepel avatar Jul 28 '23 09:07 Tlepel

Closing this issue in preparation for deprecation of the library.

andygup avatar Jan 26 '24 18:01 andygup