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

Allow a way to install js library using npm #127

Open krishnakg opened 4 years ago

krishnakg commented 4 years ago

It would be very convenient if this excellent library can be installed using npm similar to other libraries like chess.js.

mliebelt commented 4 years ago

See my work on #147 (all done on a branch). If the documentation is right, it should be easy to publish it then on NPM. Stay tuned ...

eschiendorfer commented 1 year ago

Is the installation with npm working correctly for you guys?

npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\info\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! > chessground@8.2.0 prepare
npm ERR! > $npm_execpath run compile
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
npm ERR! Der Befehl "$npm_execpath" ist entweder falsch geschrieben oder
npm ERR! konnte nicht gefunden werden.
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path C:\Users\info\AppData\Local\npm-cache\_cacache\tmp\git-cloneL4vVGM
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c $npm_execpath run compile
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     C:\Users\info\AppData\Local\npm-cache\_logs\2023-05-09T15_49_32_275Z-debug-0.log

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\info\AppData\Local\npm-cache\_logs\2023-05-09T15_49_24_479Z-debug-0.log

I am not so experienced with npm installations, but if I try other packages I don't get these errors. I tried for example to install "@mliebelt/pgn-parser": "^1.4.9" and @mliebelt/pgn-reader": "^1.2.20", they both worked fine for me :S

Any idea?

mliebelt commented 1 year ago

@eschiendorfer Could you be more concrete on what you are doing and why? The following works:

I will add later this week a current example (when hunting a bug) how to installation could be done.

What is your expectation what your command should do? If you want to have that library only, there should be better ways to do it.

mliebelt commented 1 year ago

Just tried it, did the following:

  1. Go to a new directory.
  2. Do the command npm install @mliebelt/pgn-viewer
  3. Wait ...

As a result, you get the following directory structure

package.json
package-lock.json
node_modules/
  @mliebelt/
    pgn-viewer/
      lib/
        dist.js
        dist.js.gz
        dist.js.map
        ...

and many other files. The only file you need in the context of a browser is either dist.js or dist.js.zip.

eschiendorfer commented 1 year ago

@mliebelt Yeah this is basically what I do. But the "npm install @mliebelt/pgn-viewer" leads to the errors above. Strangely I don't get this for "npm install @mliebelt/pgn-reader" as an example. But yeah, it's probably a misconfiguration on my machine... I will try to investigate it. Anyway: thanks a lot for your fast response and the viewer in general. It looks promising!

mliebelt commented 1 year ago

Hopefully you can solve it for yourself. I have no windows machine at hand (and no, that is no fun to do serious console work in windows). Have you tried to use WSL (Linux in a windows subsystem) and use npm there?

eschiendorfer commented 1 year ago

No I haven't tried WSL yet. I use such things like npm/composer maybe once in 6 months. Sometimes it works like a charm and sometimes it is headscratching ^^ But ok I also can try to use another computer :) Maybe I have more luck there or at least get a better understanding of the possible issue.