cloudflare/json-schema-tools

Getting yarn errors

paulmeems-waterwatchfoundation opened this issue · 3 comments

It seems these tools are what I need to document my json schema: https://github.com/andrejellema/GlobalCoffeeDataStandard/blob/master/global-coffee-data-standard.schema.json

But I'm having major problems installing it. I'm getting a lot of yarn errors.

I'm using Win10 and I'm not familiar with yarn.
I also installed lerna, which is new to me too.

In my dev-folder everything seems to be ok:

D:\dev>yarn --version
1.13.0
D:\dev>lerna --version
3.10.7
D:\dev>node --version
v10.15.0

In the folder that holds my schema as well:

D:\dev\GlobalCoffeeDataStandard>yarn --version
1.13.0

But in the freshly cloned json-schema-tools schema I get this:

D:\dev\json-schema-tools>yarn --version
D:\dev\json-schema-tools\scripts\yarn\bin\yarn:2
argv0=$(echo "$0" | sed -e 's,\\,/,g')
        ^^^^

SyntaxError: missing ) after argument list
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)

The documentation says I should start with lerna bootstrap. That is giving these errors:

D:\dev\json-schema-tools>lerna bootstrap
lerna notice cli v3.10.7
lerna info versioning independent
lerna info bootstrap root only
D:\dev\json-schema-tools\scripts\yarn\bin\yarn:2
argv0=$(echo "$0" | sed -e 's,\\,/,g')
        ^^^^

SyntaxError: missing ) after argument list
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
lerna ERR! yarn install --mutex network:42424 --non-interactive exited 1 in '@cloudflare/json-schema-tools'
lerna ERR! yarn install --mutex network:42424 --non-interactive exited 1 in '@cloudflare/json-schema-tools'

When I remove the .yarnrc-file it seems to work:

D:\dev\json-schema-tools>lerna bootstrap
lerna notice cli v3.10.7
lerna info versioning independent
lerna info bootstrap root only
yarn install v1.13.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "win32" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "workspace-aggregator-cc28e7f7-5fbb-42d4-b547-a3fafb988fd4 > @cloudflare/json-schema-apidoc-loader > schema-utils@0.4.5" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
[4/4] Building fresh packages...
Done in 11.82s.

I also can run doca init in my schema folder and the documentation folder is created and it contains several files.

I can also run

D:\dev\GlobalCoffeeDataStandard\git\documentation>yarn install
yarn install v1.13.0
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.35s.

But yarn start failes:

D:\dev\GlobalCoffeeDataStandard\git\documentation>yarn start
yarn run v1.13.0
$ node webpack/index | NODE_ENV=development node src/server
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 255.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

D:\dev\GlobalCoffeeDataStandard\git\documentation>× 「wdm」: Hash: 1528029a029c0dd52815
Version: webpack 3.12.0
Time: 1417ms
 Asset    Size  Chunks                    Chunk Names
app.js  3.7 MB       0  [emitted]  [big]  app
  [14] ./node_modules/react/react.js 56 bytes {0} [built]
  [33] (webpack)/buildin/module.js 517 bytes {0} [built]
  [92] ./node_modules/react-dom/index.js 59 bytes {0} [built]
 [118] ./node_modules/react-redux/es/index.js 229 bytes {0} [built]
 [158] multi webpack-hot-middleware/client?path=http://192.168.1.149:8080/__webpack_hmr ./src/client/index.js 40 bytes {0} [built]
 [159] (webpack)-hot-middleware/client.js?path=http://192.168.1.149:8080/__webpack_hmr 7.77 kB {0} [built]
 [160] ./node_modules/querystring-es3/index.js 127 bytes {0} [built]
 [163] ./node_modules/strip-ansi/index.js 161 bytes {0} [built]
 [165] (webpack)-hot-middleware/client-overlay.js 2.21 kB {0} [built]
 [170] (webpack)-hot-middleware/process-update.js 4.37 kB {0} [built]
 [171] ./src/client/index.js 710 bytes {0} [built]
 [271] ./node_modules/react-redux/es/components/Provider.js 2.17 kB {0} [built]
 [299] ./src/client/main.js 1.27 kB {0} [built]
 [425] ./node_modules/@cloudflare/doca-default-theme/styles \.less$/ 160 bytes {0} [optional] [built]
 [427] ./src/client/store.js 1.42 kB {0} [built]
    + 416 hidden modules

ERROR in ./getting-started.json
Module build failed: Error: Cannot find module '@cloudflare/json-hyper-schema'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (D:\dev\GlobalCoffeeDataStandard\git\documentation\node_modules\@cloudflare\json-schema-transform\lib\example.js:2:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.require.extensions.(anonymous function) [as .js] (D:\dev\GlobalCoffeeDataStandard\git\documentation\node_modules\babel-register\lib\node.js:152:7)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
 @ ./schemas.js 14:0-33
 @ ./src/client/store.js
 @ ./src/client/index.js
 @ multi webpack-hot-middleware/client?path=http://192.168.1.149:8080/__webpack_hmr ./src/client/index.js

After hours of trying I give up. Please assist me on how to run doca.

I had the same problems with win10.

Here is some advice for you:

  1. Please try to escape the quote mark as follows:
    argv0=$(echo ""$0"" | sed -e 's,\,/,g')

  2. Then refer to issue#5 to solve other problems. Good luck!

I know this was a while ago but the above didn't work for me, so for anyone else who is running into Windows issues and isn't familiar with Yarn, I managed to get it working another way.

The repository is configured to use a particular (included) distribution of Yarn. My assumption is that this distribution is for *nix systems which is why attempting to run it on Windows doesn't work.

If you remove the reference to the included Yarn distribution from the repository ".yarnrc" file then your system Yarn installation will be used instead which seems to work fine for the version I'm using (1.22.4).

I am having the same problem on mac