mliebelt / pgn-viewer

Simple PGN viewer with the necessary features to display chess games
GNU General Public License v3.0
163 stars 44 forks source link

Facing this error when starting turn is changed to BLACK through position param #354

Closed coffeeDev98 closed 2 years ago

coffeeDev98 commented 2 years ago

Having an issue when changing the start turn to BLACK. Example FEN: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1

image
mliebelt commented 2 years ago

Try to understand your issue, but I fail with it. Could you do the following:

I have tried to reproduce your error. What I have understood is, that you take the start position, but you want black to start the game. I did the following:

  1. Went to the configuration builder: https://mliebelt.github.io/PgnViewerJS/config/config.html
  2. Switched there the mode to edit (so I am able to do moves).
  3. Entered the FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1" into the FEN field.
  4. Went to the board, and made the first move with black. This worked.
  5. When I then tried to do the first move with white, I could not.
  6. I opened the developer console, and saw a similar error to yours.

Is that the scenario we are talking about?

I have identified the place, where the error happens, and could fix it (by using ? as the only change).

image

At the moment, I don't want to create a new version of pgn-viewer, because I expect there other errors have been introduced by myself during refactoring, going from Javascript to Typescript. I have I can do that in a few days, perhaps the next weekend.

If you want to have it earlier, do the following:

coffeeDev98 commented 2 years ago

Yes, It is the same error I've mentioned above. Even if the black move is played, PGN is not recorded and following moves cannot be played.

image
mliebelt commented 2 years ago

The commit linked is the fix for this problem. I close it now, and will see when it will be part of a new version then. There will be a hint / comment about that then.

mliebelt commented 2 years ago

I created a new release 1.5.14, you should try to upgrade, and hopefully the error is not there any more. I just checked it on the configuration builder that is online. Just published to npm as well.

coffeeDev98 commented 2 years ago

Tried to install the new release. Facing some issues

Packing chessground@https://github.com/mliebelt/Chessground.git#commit=2043d46eea121cfa8c6a6b84897bc98b5d74950c from sources
Using Yarn Classic for bootstrap. Reason: "__metadata" key not found in yarn.lock, must be a Yarn classic lockfile

➤ YN0000: Downloading https://nightly.yarnpkg.com/latest.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-1.23.0-20220130.1630.cjs
➤ YN0000: Done in 0s 478ms

yarn install v1.23.0-20220130.1630
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
$ $npm_execpath run compile
Internal Error: chessground@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile
    at gS.getCandidates (/Users/user/Desktop/betterEd/better-class/.yarn/releases/yarn-sources.cjs:285:4265)
    at lc.getCandidates (/Users/user/Desktop/betterEd/better-class/.yarn/releases/yarn-sources.cjs:281:4819)
    at /Users/user/Desktop/betterEd/better-class/.yarn/releases/yarn-sources.cjs:295:7544
    at Object.prettifyAsyncErrors (/Users/user/Desktop/betterEd/better-class/.yarn/releases/yarn-sources.cjs:10:30361)
    at D (/Users/user/Desktop/betterEd/better-class/.yarn/releases/yarn-sources.cjs:295:7507)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
coffeeDev98 commented 2 years ago

Doesn't happen with the other versions though...

mliebelt commented 2 years ago

My problem with the latest release of Chessground was, that I had errors due to not all imports were done with the extension .js.

If you want to look at it:

The commit says: colophon Fix invalid es module output

So if you use the version 8.2.0 in your Typescript project, you have to fix that somehow. I tried to use the latest version in my package.json ==> "chessground": "mliebelt/Chessground" that means it uses my fork (without any release information) which contains the current fix. I don't build it, just use it as it is.

So no, I have no idea where your problem comes from, but for me it worked. By downloading my release, the people should be able to use the release directly (not the Typescript sources perhaps), at least my HTML examples are all running.

Sorry that I have no idea where your problem comes from, I can only explain why I had to find some solution for the latest release of Chessground. Don't know which they are not doing a release for it ...

coffeeDev98 commented 2 years ago

I'm using typescript version ^4.2.3

coffeeDev98 commented 2 years ago

I get the following error when trying to install ➤ YN0058: │ chessground@https://github.com/mliebelt/Chessground.git#commit=2043d46eea121cfa8c6a6b84897bc98b5d74950c: Packing the package failed (exit code 1, logs can be found here: /private/var/folders/fx/1gzks4s56z993h86h1sqvcjw0000gn/T/xfs-b12d9b06/pack.log)

mliebelt commented 2 years ago

Sorry, it is really difficult to diagnose anything, because there are only snippets available. So again, do you have a public reference to the project that you are trying to do? Any reference, where I can find something? What did you do to provoke the error? When I use my fork of Chessground, no build at all is triggered (and no, it is not necessary, you can use it right from the sources).

mliebelt commented 2 years ago

I tried it again. This is what I did:

  1. Copy the current state of the complete repository to a local directory.
  2. Go the root directory (of that zip file), and start npm install.
  3. Go to modules/pgn-reader, and start there npm install.
  4. Go to modules/pgn-viewer, and start there npm install.

This works for me, no error. What you could do

  1. Repeat what I did, in the same order.
  2. Write down everything you do, get as result, ... that is not obvious.
  3. Go to your clone of PgnViewerJS, and enable there issues.
  4. Create a new ticket, and provide exactly how to get the wrong behavior from above.

The reasons for that are:

Sorry, sound unpolite, but we are now discussing for many days (in a closed ticket) something completely unrelated. Please, follow my advise here.

coffeeDev98 commented 2 years ago

No no, I understand. It's not unpolite. Sorry for dragging this discussion. It took me a while to come down to a reproducible scenario as the package worked fine in other projects.

Did some testing with yarn and noticed the issue occurs in yarn versions above 1.23.x. Our project currently requires to be run on yarn v2.4.0

But you can reproduce this issue with yarn v3.2.0

mliebelt commented 2 years ago

I cannot. Please follow my advise ...