mliebelt / pgn-viewer

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

Unable to `npm install` on Windows OS #491

Open Bebul opened 8 months ago

Bebul commented 8 months ago

It is a fresh problem. After 1d51383a978dbc9af46bb06e48e42712d8637ad2 the npm install ends with errors, while when checkouting the previous commit 868240435857f9a56faf2ab2068fc993c6ee711a it works without any error.

The C:\WINDOWS\system32\cmd.exe /d /s /c $npm_execpath run compile cannot work on Windows OS, as there should be %npm_execpath% or something, and also this environment variable set. Maybe the package.json contains more than necessary?

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\bebul\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-au
dit --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! '$npm_execpath' is not recognized as an internal or external command,
npm ERR! operable program or batch file.
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path C:\Users\bebul\AppData\Local\npm-cache\_cacache\tmp\git-cloneEa9WIH
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c $npm_execpath run compile
Bebul commented 8 months ago

Sorry. It looks it does not work on the 868240435857f9a56faf2ab2068fc993c6ee711a either. npm install does not end with errors, but it does not install modules/pgn-viewer/package.json. When I try to install it the same errors happen.

Bebul commented 8 months ago

So I am trying to experiment over the fresh 1d51383a978dbc9af46bb06e48e42712d8637ad2 state... When I remove the dependance line:

    "chessground": "mliebelt/Chessground",

The npm install works, but the build fails for

Module not found: Error: Can't resolve 'chessground' in 'D:\dev\PgnViewerJS-original\src'
Bebul commented 8 months ago

So, it looks like mliebelt/chessboard relevant issue, which is only fork of the original lichess chessboard. I have tried to run yarn install here and it fails with the exactly the same reason:

'$npm_execpath' is not recognized as an internal or external command

When I replace the environment variable with

"prepare": "npm run compile", // instead of "prepare": "$npm_execpath run compile",

I am able to run yarn install and process demo.html.

Bebul commented 8 months ago

I think, there are two possible ways to overcome this issue:

  1. avoid using github repository as a library and deploy it into some @mliebelt/chessboard and use this one.
  2. or try to make mliebelt/Chessboard cross platform
    • I have already tried to do it on the clone of your repository and I was able to build the chessboard
    • I will try to use it in the PgnViewerJS and if it works, I will try to pose a Pull Request
Bebul commented 8 months ago

And here you are https://github.com/mliebelt/chessground/pull/1

(I think, if the PR will be accepted (please, try it) then this issue can be closed.)

mliebelt commented 8 months ago

Ok, I have merged your pull request. I tried some months ago to upgrade Chessground to the newest version, but failed, and did not find out the reason for that. Perhaps I will try that again, to get rid of the necessity to build Chessground on my own. For the moment, you should be able to build pgn-viewer again.

Bebul commented 8 months ago

Perhaps I will try that again, to get rid of the necessity to build Chessground on my own.

It was first thing I tried too. Also failed. I will try again.

For the moment, you should be able to build pgn-viewer again.

I was able to do so using my own build, forking yours, so I expect it really should work now.

Thank you 👍