blueprint icon indicating copy to clipboard operation
blueprint copied to clipboard

`yarn verify` throw an error on Windows 10, docs-data package fails to build

Open lmk123 opened this issue 4 years ago • 4 comments

Environment

  • Operating System: Windows 10
  • Node version: v12.18.1
  • Npm version: v6.14.5
  • Yarn version: v1.22.4

Code Sandbox

Link to a minimal repro: https://github.com/lmk123/blueprint/tree/patch-1

Steps to reproduce

  1. Run yarn global add windows-build-tools in PowerShell
  2. Run git clone https://github.com/lmk123/blueprint.git and checkout patch-1 branch
  3. Run yarn install in repo
  4. Run npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
  5. Run yarn verify

Actual behavior

yarn verify throw an error whin it run into node ./compile-docs-data.js:

C:\Users\Mica\WebstormProjects\blueprint>yarn verify
yarn run v1.22.4
$ npm-run-all -s compile dist:libs dist:apps -p test lint format-check
$ lerna run compile
lerna notice cli v3.22.0
lerna info versioning independent
lerna info Executing command in 11 packages: "yarn run compile"
lerna info run Ran npm script 'compile' in '@blueprintjs/test-commons' in 4.2s:
$ tsc -p ./src
lerna info run Ran npm script 'compile' in '@blueprintjs/tslint-config' in 4.9s:
$ tsc -p ./src
lerna info run Ran npm script 'compile' in '@blueprintjs/eslint-plugin' in 5.0s:
$ tsc -p src/
lerna info run Ran npm script 'compile' in '@blueprintjs/icons' in 6.8s:
$ npm-run-all -s "compile:pre" -p "compile:*"
$ generate-icons-source
$ generate-icons-source
$ tsc -p ./src
$ tsc -p ./src -m commonjs --outDir lib/cjs
$ tsc -p ./src -t esnext --outDir lib/esnext
$ sass-compile ./src
Rendering Complete, saving .css file...
Wrote CSS to C:\Users\Mica\WebstormProjects\blueprint\packages\icons\lib\css\blueprint-icons.css
Wrote Source Map to C:\Users\Mica\WebstormProjects\blueprint\packages\icons\lib\css\blueprint-icons.css.map
lerna info run Ran npm script 'compile' in '@blueprintjs/core' in 8.1s:
$ run-p "compile:*"
$ tsc -p ./src
$ tsc -p ./src -m commonjs --outDir lib/cjs
$ tsc -p ./src -t esnext --outDir lib/esnext
$ sass-compile ./src --functions ./scripts/sass-custom-functions.js
Rendering Complete, saving .css file...
Wrote Source Map to C:\Users\Mica\WebstormProjects\blueprint\packages\core\lib\css\blueprint-hi-contrast.css.map
Wrote CSS to C:\Users\Mica\WebstormProjects\blueprint\packages\core\lib\css\blueprint-hi-contrast.css
Rendering Complete, saving .css file...
Wrote CSS to C:\Users\Mica\WebstormProjects\blueprint\packages\core\lib\css\blueprint.css
Wrote Source Map to C:\Users\Mica\WebstormProjects\blueprint\packages\core\lib\css\blueprint.css.map
lerna info run Ran npm script 'compile' in '@blueprintjs/datetime' in 12.8s:
$ run-p "compile:*"
$ tsc -p ./src -t esnext --outDir lib/esnext
$ tsc -p ./src -m commonjs --outDir lib/cjs
$ tsc -p ./src
$ sass-compile ./src
Rendering Complete, saving .css file...
Wrote CSS to C:\Users\Mica\WebstormProjects\blueprint\packages\datetime\lib\css\blueprint-datetime.css
Wrote Source Map to C:\Users\Mica\WebstormProjects\blueprint\packages\datetime\lib\css\blueprint-datetime.css.map
lerna info run Ran npm script 'compile' in '@blueprintjs/table' in 13.3s:
$ run-p "compile:*"
$ tsc -p ./src
$ tsc -p ./src -t esnext --outDir lib/esnext
$ tsc -p ./src -m commonjs --outDir lib/cjs
$ sass-compile ./src
Rendering Complete, saving .css file...
Wrote Source Map to C:\Users\Mica\WebstormProjects\blueprint\packages\table\lib\css\table.css.map
Wrote CSS to C:\Users\Mica\WebstormProjects\blueprint\packages\table\lib\css\table.css
lerna info run Ran npm script 'compile' in '@blueprintjs/select' in 13.3s:
$ run-p "compile:*"
$ tsc -p ./src -t esnext --outDir lib/esnext
$ tsc -p ./src
$ tsc -p ./src -m commonjs --outDir lib/cjs
$ sass-compile ./src
Rendering Complete, saving .css file...
Wrote CSS to C:\Users\Mica\WebstormProjects\blueprint\packages\select\lib\css\blueprint-select.css
Wrote Source Map to C:\Users\Mica\WebstormProjects\blueprint\packages\select\lib\css\blueprint-select.css.map
lerna info run Ran npm script 'compile' in '@blueprintjs/timezone' in 8.4s:
$ run-p "compile:*"
$ tsc -p ./src -m commonjs --outDir lib/cjs
$ tsc -p ./src -t esnext --outDir lib/esnext
$ tsc -p ./src
$ sass-compile ./src
Rendering Complete, saving .css file...
Wrote CSS to C:\Users\Mica\WebstormProjects\blueprint\packages\timezone\lib\css\blueprint-timezone.css
Wrote Source Map to C:\Users\Mica\WebstormProjects\blueprint\packages\timezone\lib\css\blueprint-timezone.css.map
lerna info run Ran npm script 'compile' in '@blueprintjs/docs-theme' in 9.0s:
$ run-p "compile:*"
$ tsc -p ./src
$ tsc -p ./src -m commonjs --outDir lib/cjs
$ tsc -p ./src -t esnext --outDir lib/esnext
$ sass-compile ./src
Rendering Complete, saving .css file...
Wrote CSS to C:\Users\Mica\WebstormProjects\blueprint\packages\docs-theme\lib\css\docs-theme.css
Wrote Source Map to C:\Users\Mica\WebstormProjects\blueprint\packages\docs-theme\lib\css\docs-theme.css.map
lerna ERR! yarn run compile exited 1 in '@blueprintjs/docs-data'
lerna ERR! yarn run compile stdout:
$ node ./compile-docs-data.js
[docs-data] ERROR when generating JSON docs data:
' in toTree()n @page 'blueprint
    at PageMap.toTree (C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\page.js:61:19)
    at C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\page.js:67:45
    at Array.forEach (<anonymous>:null:null)
    at PageMap.toTree (C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\page.js:64:23)
    at MarkdownPlugin.compile (C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\plugins\markdown.js:46:29)
    at Documentalist.<anonymous> (C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\documentalist.js:95:58)
    at Generator.next (<anonymous>:null:null)
    at C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\documentalist.js:23:71
    at new Promise (<anonymous>:null:null)
    at __awaiter (C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\documentalist.js:19:12)
    at Documentalist.documentFiles (C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\documentalist.js:88:16)
    at Documentalist.<anonymous> (C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\documentalist.js:77:25)
    at Generator.next (<anonymous>:null:null)
    at C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\documentalist.js:23:71
    at new Promise (<anonymous>:null:null)
    at __awaiter (C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\documentalist.js:19:12)
    at Documentalist.documentGlobs (C:\Users\Mica\WebstormProjects\blueprint\node_modules\@documentalist\compiler\lib\documentalist.js:75:16)
    at generateDocumentalistData (C:\Users\Mica\WebstormProjects\blueprint\packages\docs-data\compile-docs-data.js:65:10)
    at C:\Users\Mica\WebstormProjects\blueprint\packages\docs-data\compile-docs-data.js:32:15
    at Object.<anonymous> (C:\Users\Mica\WebstormProjects\blueprint\packages\docs-data\compile-docs-data.js:42:3)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

lerna ERR! yarn run compile stderr:
Found duplicate page "index"; overwriting previous data.
Rename headings or use metadata `reference` key to disambiguate.
Found duplicate page "index"; overwriting previous data.
Rename headings or use metadata `reference` key to disambiguate.
Found duplicate page "index"; overwriting previous data.
Rename headings or use metadata `reference` key to disambiguate.
Found duplicate page "index"; overwriting previous data.
Rename headings or use metadata `reference` key to disambiguate.
error Command failed with exit code 1.

lerna ERR! yarn run compile exited 1 in '@blueprintjs/docs-data'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "compile" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior

No error.

Possible solution

This seems to be related to https://github.com/palantir/blueprint/issues/3062#issuecomment-439363356

lmk123 avatar Jul 10 '20 18:07 lmk123

Sorry for the inconvenience... hopefully someone with a bit more windows experience can help fix this build issue. In the meantime, you can still build and test parts of the repo. Check out the tasks listed in "scripts" in each package.json. For example:

cd packages/core
yarn compile
yarn test

adidahiya avatar Jul 15 '20 17:07 adidahiya

I also encountered this problem. I found that \r exists in the *.md document stream, so I modified "this.extractMetadata(blockContent.trim().replace(/[\r]/g,''))" in "node_modules@documentalist\compiler\lib\compiler.js", just replace \r

alex1221 avatar Aug 07 '21 02:08 alex1221

I had this same problem and @alex1221's suggestion helped, but later the build fails with:

@blueprintjs/core: undefined:3
@blueprintjs/core: throw error;
@blueprintjs/core: ^
@blueprintjs/core: Error: There's already a module with namespace "math".
@blueprintjs/core:     ╷
@blueprintjs/core: 1   │ @use "sass:math";
@blueprintjs/core:     │ ━━━━━━━━━━━━━━━━ original @use
@blueprintjs/core: ... │
@blueprintjs/core: 167 │ @use "sass:math";
@blueprintjs/core:     │ ^^^^^^^^^^^^^^^^ new @use
@blueprintjs/core:     ╵
@blueprintjs/core:   stdin 167:1  root stylesheet
@blueprintjs/core:     at Object.wrapException (D:\projects\blueprint\node_modules\sass\sass.dart.js:1254:17)
@blueprintjs/core:     at Environment0.addModule$3$namespace (D:\projects\blueprint\node_modules\sass\sass.dart.js:78322:19)
@blueprintjs/core:     at _EvaluateVisitor_visitUseRule_closure1.call$1 (D:\projects\blueprint\node_modules\sass\sass.dart.js:81714:42)
@blueprintjs/core:     at _EvaluateVisitor__loadModule_closure3.call$0 (D:\projects\blueprint\node_modules\sass\sass.dart.js:80923:28)
@blueprintjs/core:     at _EvaluateVisitor1._evaluate0$_addExceptionSpan$1$2 (D:\projects\blueprint\node_modules\sass\sass.dart.js:80650:23)
@blueprintjs/core:     at _EvaluateVisitor1._evaluate0$_addExceptionSpan$2 (D:\projects\blueprint\node_modules\sass\sass.dart.js:80671:19)
@blueprintjs/core:     at _EvaluateVisitor1._evaluate0$_loadModule$7$baseUrl$configuration$namesInErrors (D:\projects\blueprint\node_modules\sass\sass.dart.js:79071:15)
@blueprintjs/core:     at _EvaluateVisitor1._evaluate0$_loadModule$5$configuration (D:\projects\blueprint\node_modules\sass\sass.dart.js:79077:19)
@blueprintjs/core:     at _EvaluateVisitor1.visitUseRule$1 (D:\projects\blueprint\node_modules\sass\sass.dart.js:79843:13)
@blueprintjs/core:     at UseRule0.accept$1$1 (D:\projects\blueprint\node_modules\sass\sass.dart.js:96439:22) {
@blueprintjs/core:   formatted: `Error: There's already a module with namespace "math".\n` +
@blueprintjs/core:     '    ╷\n' +
@blueprintjs/core:     '1   │ @use "sass:math";\n' +
@blueprintjs/core:     '    │ ━━━━━━━━━━━━━━━━ original @use\n' +
@blueprintjs/core:     '... │\n' +
@blueprintjs/core:     '167 │ @use "sass:math";\r\n' +
@blueprintjs/core:     '    │ ^^^^^^^^^^^^^^^^ new @use\n' +
@blueprintjs/core:     '    ╵\n' +
@blueprintjs/core:     '  stdin 167:1  root stylesheet',
@blueprintjs/core:   line: 167,
@blueprintjs/core:   column: 1,
@blueprintjs/core:   file: 'stdin',
@blueprintjs/core:   status: 1
@blueprintjs/core: }
@blueprintjs/core: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@blueprintjs/core: error Command failed with exit code 1.
@blueprintjs/core: ERROR: "dist:variables" exited with 1.
@blueprintjs/core: error Command failed with exit code 1.
@blueprintjs/core: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

alex-c avatar Jun 13 '22 19:06 alex-c

By the way, I managed to fix the original problem by checking out the repo again with autocrlf set to false in my git client.

alex-c avatar Jun 17 '22 09:06 alex-c