Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't yarn add package #16

Closed
biowaffeln opened this issue Aug 18, 2018 · 7 comments
Closed

can't yarn add package #16

biowaffeln opened this issue Aug 18, 2018 · 7 comments

Comments

@biowaffeln
Copy link
Contributor

I tried installing the package with yarn add cm-chessboard and got the following error message:

error C:\Users\Mark\Documents\Coding Projekte\chess-notation\node_modules\cm-chessboard: Command failed.
Exit code: 1
Command: node postinstall.js
Arguments:
Directory: C:\Users\Mark\Documents\Coding Projekte\chess-notation\node_modules\cm-chessboard
Output:
internal/modules/cjs/loader.js:550
    throw err;
    ^

Error: Cannot find module 'web-module-linker'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
    at Function.Module._load (internal/modules/cjs/loader.js:475:25)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at Object.<anonymous> (C:\Users\Mark\Documents\Coding Projekte\chess-notation\node_modules\cm-chessboard\postinstall.js:6:25)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)

Any idea what the problem could be?

@shaack
Copy link
Owner

shaack commented Aug 18, 2018

The 'web-module-linker', which is an devDependency is needed for the postinstall.js script. It should work, if you install 'web-module-linker' before as global. The problem is: I don't know how to ensure that the dependency is installed before the postinstall.js is running.

@shaack
Copy link
Owner

shaack commented Aug 18, 2018

I moved the 'web-module-linker' from devDependency to dependency. (v2.13.7) Does it work now?

@biowaffeln
Copy link
Contributor Author

biowaffeln commented Aug 18, 2018

Good news: web-module-linker got installed first, so that worked
Bad news: this time I got the following error message:

C:\Users\Mark\Documents\Coding Projekte\chess-notation\node_modules\cm-chessboard: Command failed.
Exit code: 1
Command: node postinstall.js
Arguments:
Directory: C:\Users\Mark\Documents\Coding Projekte\chess-notation\node_modules\cm-chessboard
Output:
mkdir lib
Linking ..\..\svjs-svg\src\svjs-svg => ./lib/svjs-svg (dir)
fs.js:1031
  return binding.symlink(preprocessSymlinkDestination(target, type, path),
                 ^

Error: EPERM: operation not permitted, symlink '..\..\svjs-svg\src\svjs-svg' -> 'C:\Users\Mark\Documents\Coding Projekte\chess-notation\node_modules\cm-chessboard\lib\svjs-svg'
    at Object.fs.symlinkSync (fs.js:1031:18)

Seems to be a windows problem, apparently windows doesn't allow symlinks without admin rights 🤔

@biowaffeln
Copy link
Contributor Author

I just tried it out, the problem is indeed symlinks + admin rights. If I yarn add it in a powershell with admin rights, the installation will work.
Is it really necessary to use web-module-linker? After all, your README still says "no Dependencies except svjs-svg" 😜

@shaack
Copy link
Owner

shaack commented Aug 19, 2018

Yes, right. :) The linking is necessay to use ES6 modules and npm/yarn together without transpiling. ES6, web and npm are not really compatible. Maybe transpiling would be the best way, but this destroys the es6 module concept.

@biowaffeln
Copy link
Contributor Author

I see. I created a PR (#17) that includes a note about this issue on the README for now, in case anyone else runs into it

@shaack
Copy link
Owner

shaack commented Aug 20, 2018

Nice, thanks. For now an info to Windows users is the best solution. I think, when I have some time left in future, I will create a packaged distribution which combines svjs-svg and all chessboard classes and allows easy using cm-chessboard without symlinks.

@shaack shaack closed this as completed Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants