Cannot run a development install using theme-cookiecutter

I cannot complete a development install as described in theme’s README.md:

For a development install (requires npm version 4 or later), do the following in the repository directory:

npm install
jupyter labextension link .

Here are the steps to reproduce:

$ cookiecutter --no-input https://github.com/jupyterlab/theme-cookiecutter
$ cd mytheme
$ npm install
npm WARN deprecated @types/handlebars@4.1.0: This is a stub types definition. handlebars provides its own type definitions, so you do not need this installed.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1

> fsevents@1.2.11 install /Users/ynkt/tmp/mytheme/node_modules/fsevents
> node-gyp rebuild

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> mytheme@0.1.0 prepare /Users/ynkt/tmp/mytheme
> npm run clean && npm run build


> mytheme@0.1.0 clean /Users/ynkt/tmp/mytheme
> rimraf lib && rimraf static && rimraf tsconfig.tsbuildinfo


> mytheme@0.1.0 build /Users/ynkt/tmp/mytheme
> tsc

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN ws@7.2.1 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.2.1 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.

added 995 packages from 1767 contributors and audited 19060 packages in 20.942s
found 7 vulnerabilities (1 low, 4 moderate, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details
$ jupyter labextension link .
An error occured.
ValueError:
"mytheme@0.1.0" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab              Extension      Package
>=1.2.1 <1.3.0          >=2.0.0-beta.2 <3.0.0@jupyterlab/application
>=1.2.1 <1.3.0          >=2.0.0-beta.2 <3.0.0@jupyterlab/apputils
See the log file for details:  /var/folders/43/14qb6f816gn4sgy_cz5p1l4h0000gn/T/jupyterlab-debug-mli3qapc.log

I know what JupyterLab is complaining about. What I don’t understand is where >=1.2.1 <1.3.0 (or possibly ~1.2.1) comes from. Version 2.0.0-beta.3 is installed for both dependencies, and this is compliant with mytheme/package.json (i.e., ^2.0.0-beta.2).

How can I fix this error and start previewing my theme?

FWIW, the output of jupyter --version is as follows:

$ jupyter --version
jupyter core     : 4.6.1
jupyter-notebook : 6.0.3
qtconsole        : not installed
ipython          : 7.12.0
ipykernel        : 5.1.4
jupyter client   : 5.3.4
jupyter lab      : 1.2.6
nbconvert        : 5.6.1
ipywidgets       : not installed
nbformat         : 5.0.4
traitlets        : 4.3.3

I believe the cookie-cutter has been updated to JupyterLab 2.x and your dependency list shows you are using JupyterLab 1.2.6.

Easiest way would be to checkout the previous-to-last commit and build/install and give it a try.

I reinstalled npm packages after downgrading the conflicting dependencies to ^1.0.0, and encountered another error.

$ rm -rf node_modules && npm install
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1

> fsevents@1.2.11 install /Users/ynkt/tmp/mytheme/node_modules/fsevents
> node-gyp rebuild

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> mytheme@0.1.0 prepare /Users/ynkt/tmp/mytheme
> npm run clean && npm run build


> mytheme@0.1.0 clean /Users/ynkt/tmp/mytheme
> rimraf lib && rimraf static && rimraf tsconfig.tsbuildinfo


> mytheme@0.1.0 build /Users/ynkt/tmp/mytheme
> tsc

node_modules/@jupyterlab/application/lib/lab.d.ts:9:57 - error TS2344: Type 'ILabShell' does not satisfy the constraint 'IShell'.
  Types of property 'currentWidget' are incompatible.
    Type 'Widget | null' is not assignable to type 'Widget'.
      Type 'null' is not assignable to type 'Widget'.

9 export declare class JupyterLab extends JupyterFrontEnd<ILabShell> {
                                                          ~~~~~~~~~

node_modules/@jupyterlab/application/lib/lab.d.ts:69:57 - error TS2344: Type 'LabShell' does not satisfy the constraint 'IShell'.
  Types of property 'currentWidget' are incompatible.
    Type 'Widget | null' is not assignable to type 'Widget'.
      Type 'null' is not assignable to type 'Widget'.

69     interface IOptions extends JupyterFrontEnd.IOptions<LabShell>, Partial<IInfo> {
                                                           ~~~~~~~~

node_modules/@jupyterlab/application/lib/shell.d.ts:118:14 - error TS2416: Property 'currentWidget' in type 'LabShell' is not assignable to the same property in base type 'IShell'.
  Type 'Widget | null' is not assignable to type 'Widget'.
    Type 'null' is not assignable to type 'Widget'.

118     readonly currentWidget: Widget | null;
                 ~~~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:26:9 - error TS2411: Property 'codemirror_mode' of type 'string | JSONObject | undefined' is not assignable to string index type 'JSONValue'.

26         codemirror_mode?: string | JSONObject;
           ~~~~~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:27:9 - error TS2411: Property 'file_extension' of type 'string | undefined' is not assignable to string index type 'JSONValue'.

27         file_extension?: string;
           ~~~~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:28:9 - error TS2411: Property 'mimetype' of type 'string | undefined' is not assignable to string index type 'JSONValue'.

28         mimetype?: string;
           ~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:29:9 - error TS2411: Property 'pygments_lexer' of type 'string | undefined' is not assignable to string index type 'JSONValue'.

29         pygments_lexer?: string;
           ~~~~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:35:9 - error TS2411: Property 'kernelspec' of type 'IKernelspecMetadata | undefined' is not assignable to string index type 'JSONValue'.

35         kernelspec?: IKernelspecMetadata;
           ~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:36:9 - error TS2411: Property 'language_info' of type 'ILanguageInfoMetadata | undefined' is not assignable to string index type 'JSONValue'.

36         language_info?: ILanguageInfoMetadata;
           ~~~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:116:9 - error TS2411: Property 'jupyter' of type 'Partial<IBaseCellJupyterMetadata>' is not assignable to string index type 'JSONValue'.

116         jupyter: Partial<IBaseCellJupyterMetadata>;
            ~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:137:9 - error TS2411: Property 'metadata' of type 'Partial<IBaseCellMetadata> | Partial<IRawCellMetadata> | Partial<ICodeCellMetadata>' is not assignable to string index type 'JSONValue'.

137         metadata: Partial<ICellMetadata>;
            ~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:159:9 - error TS2411: Property 'metadata' of type 'Partial<IRawCellMetadata>' is not assignable to string index type 'JSONValue'.

159         metadata: Partial<IRawCellMetadata>;
            ~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:163:9 - error TS2411: Property 'attachments' of type 'IAttachments | undefined' is not assignable to string index type 'JSONValue'.

163         attachments?: IAttachments;
            ~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:176:9 - error TS2411: Property 'attachments' of type 'IAttachments | undefined' is not assignable to string index type 'JSONValue'.

176         attachments?: IAttachments;
            ~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:198:9 - error TS2411: Property 'jupyter' of type 'Partial<ICodeCellJupyterMetadata>' is not assignable to string index type 'JSONValue'.

198         jupyter: Partial<ICodeCellJupyterMetadata>;
            ~~~~~~~

node_modules/@jupyterlab/coreutils/lib/nbformat.d.ts:215:9 - error TS2411: Property 'metadata' of type 'Partial<ICodeCellMetadata>' is not assignable to string index type 'JSONValue'.

215         metadata: Partial<ICodeCellMetadata>;
            ~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/tokens.d.ts:180:9 - error TS2411: Property 'description' of type 'string | undefined' is not assignable to string index type 'JSONValue'.

180         description?: string;
            ~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/tokens.d.ts:184:9 - error TS2411: Property 'properties' of type '{ [property: string]: IProperty; } | undefined' is not assignable to string index type 'JSONValue'.

184         properties?: {
            ~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/tokens.d.ts:190:9 - error TS2411: Property 'title' of type 'string | undefined' is not assignable to string index type 'JSONValue'.

190         title?: string;
            ~~~~~

node_modules/@jupyterlab/coreutils/lib/tokens.d.ts:194:9 - error TS2411: Property 'type' of type '"string" | "number" | "boolean" | "object" | "array" | "null" | Primitive[] | undefined' is not assignable to string index type 'JSONValue'.

194         type?: Primitive | Primitive[];
            ~~~~

node_modules/@jupyterlab/coreutils/lib/tokens.d.ts:209:9 - error TS2411: Property ''jupyter.lab.setting-deprecated'' of type 'boolean | undefined' is not assignable to string index type 'JSONValue'.

209         'jupyter.lab.setting-deprecated'?: boolean;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/tokens.d.ts:213:9 - error TS2411: Property ''jupyter.lab.setting-icon-class'' of type 'string | undefined' is not assignable to string index type 'JSONValue'.

213         'jupyter.lab.setting-icon-class'?: string;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/tokens.d.ts:217:9 - error TS2411: Property ''jupyter.lab.setting-icon-label'' of type 'string | undefined' is not assignable to string index type 'JSONValue'.

217         'jupyter.lab.setting-icon-label'?: string;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/tokens.d.ts:230:9 - error TS2411: Property ''jupyter.lab.transform'' of type 'boolean | undefined' is not assignable to string index type 'JSONValue'.

230         'jupyter.lab.transform'?: boolean;
            ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/tokens.d.ts:234:9 - error TS2411: Property ''jupyter.lab.shortcuts'' of type 'IShortcut[] | undefined' is not assignable to string index type 'JSONValue'.

234         'jupyter.lab.shortcuts'?: IShortcut[];
            ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@jupyterlab/coreutils/lib/tokens.d.ts:356:9 - error TS2411: Property 'args' of type 'JSONObject | undefined' is not assignable to string index type 'JSONValue'.

356         args?: JSONObject;
            ~~~~

node_modules/@jupyterlab/coreutils/lib/tokens.d.ts:364:9 - error TS2411: Property 'disabled' of type 'boolean | undefined' is not assignable to string index type 'JSONValue'.

364         disabled?: boolean;
            ~~~~~~~~

node_modules/@jupyterlab/services/lib/kernel/kernel.d.ts:849:18 - error TS2411: Property 'env' of type 'JSONObject | undefined' is not assignable to string index type 'JSONValue'.

849         readonly env?: JSONObject;
                     ~~~

node_modules/@jupyterlab/services/lib/kernel/kernel.d.ts:859:18 - error TS2411: Property 'metadata' of type 'JSONObject | undefined' is not assignable to string index type 'JSONValue'.

859         readonly metadata?: JSONObject;
                     ~~~~~~~~

node_modules/@jupyterlab/services/lib/kernel/messages.d.ts:494:9 - error TS2411: Property 'nbconverter_exporter' of type 'string | undefined' is not assignable to string index type 'JSONValue'.

494         nbconverter_exporter?: string;
            ~~~~~~~~~~~~~~~~~~~~


Found 60 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mytheme@0.1.0 build: `tsc`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mytheme@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ynkt/.npm/_logs/2020-02-04T14_41_56_442Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mytheme@0.1.0 prepare: `npm run clean && npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mytheme@0.1.0 prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ynkt/.npm/_logs/2020-02-04T14_41_56_486Z-debug.log

If I set the strict option to false in tsconfig.json, it works well.

$ npm run clean && npm run build

> mytheme@0.1.0 clean /Users/ynkt/tmp/mytheme
> rimraf lib && rimraf static && rimraf tsconfig.tsbuildinfo


> mytheme@0.1.0 build /Users/ynkt/tmp/mytheme
> tsc

$ jupyter labextension link .
Building jupyterlab assets (build:dev:minimize)

So some type definitions seem to be cause of the error, but I successfully finished the installation. Thank you.