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

Throws because of multiple versions of can-cid #282

Closed
matthewp opened this issue Oct 27, 2017 · 13 comments
Closed

Throws because of multiple versions of can-cid #282

matthewp opened this issue Oct 27, 2017 · 13 comments
Assignees
Labels

Comments

@matthewp
Copy link
Contributor

Error is:

	throw new Error("You can't have two versions of can-cid, check your dependencies");
	^

Error: You can't have two versions of can-cid, check your dependencies
    at Object.<anonymous> (file:/Users/matthew/dev/donejs/place-my-order/node_modules/can-cid/can-cid.js:53:8)
    at file:/Users/matthew/dev/donejs/place-my-order/node_modules/can-cid/can-cid.js:58:4
    at file:/Users/matthew/dev/donejs/place-my-order/node_modules/can-cid/can-cid.js:58:98
    at ContextifyScript.Script.runInThisContext (vm.js:50:33)
    at Object.runInThisContext (vm.js:139:38)
    at doEval (/Users/matthew/dev/donejs/place-my-order/node_modules/steal-systemjs/dist/system.src.js:2059:10)
    at __eval (/Users/matthew/dev/donejs/place-my-order/node_modules/steal-systemjs/dist/system.src.js:1976:7)
    at Loader.exec [as __exec] (/Users/matthew/dev/donejs/place-my-order/node_modules/steal-systemjs/dist/system.src.js:339:5)
    at load.metadata.execute (/Users/matthew/dev/donejs/place-my-order/node_modules/steal-systemjs/dist/system.src.js:1217:16)
    at linkDynamicModule (/Users/matthew/dev/donejs/place-my-order/node_modules/steal-systemjs/dist/system.src.js:668:32)
@matthewp
Copy link
Contributor Author

There aren't actually multiple versions of can-cid. The way documentjs is configured is what causes this. I think a new approach to the build should be taken. I would:

  1. Find the root project's node_modules/ folder.
  2. Copy the entire thing into whereever the build script runs.
  3. Give the build project a package.json with all of its deps.
  4. Run the build as an npm project.

@matthewp matthewp added the bug label Oct 27, 2017
matthewp added a commit to donejs/donejs-documentjs that referenced this issue Oct 27, 2017
This downgrades to documentjs 0.4.x because of
bitovi/documentjs#282
@danguilherme
Copy link

I created a new project to try out documentcss and I am having the same issue...

Here's a summary of what I did (TL;DR: followed the tutorial):

$ npm init
$ npm install documentjs --save
$ mkdir styles && touch styles/styles.md # and added the contents from the tutorial
$ touch documentjs.json # and added the contents from the tutorial
$ ./node_modules/.bin/documentjs

@imaustink imaustink self-assigned this Nov 21, 2017
@jiwebdev
Copy link

jiwebdev commented Dec 5, 2017

I am having the same issue with documentjs. I did everything according to the tutorial but I am getting this same error. Is there a fix?

`...patternlibrary2>.\node_modules.bin\documentjs

Generating styles at styleguide
file:C:/****/patternlibrary2/node_modules/can-cid/can-cid.js:52
throw new Error("You can't have two versions of can-cid, check your dependencies");
^

Error: You can't have two versions of can-cid, check your dependencies
at Object. (file:C://patternlibrary2/node_modules/can-cid/can-cid.js:
52:8)
at file:C:/
/patternlibrary2/node_modules/can-cid/can-cid.js:57:4
at file:C://patternlibrary2/node_modules/can-cid/can-cid.js:57:98
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at Object.runInThisContext (vm.js:139:38)
at doEval (C:*
\patternlibrary2\node_modules\steal-systemjs\dist\system.src.js:20
59:10)
at __eval (C:*
\patternlibrary2\node_modules\steal-systemjs\dist\system.src.js:19
76:7)
at Loader.exec [as __exec] (C:*
\patternlibrary2\node_modules\steal-systemjs\dist
\system.src.js:339:5)
at load.metadata.execute (C:*
\patternlibrary2\node_modules\steal-systemjs\dist\s
ystem.src.js:1217:16)
at linkDynamicModule (C:*
*\patternlibrary2\node_modules\steal-systemjs\dist\syste
m.src.js:668:32)
`

@phillipskevin
Copy link

Changing can-cid to not use a relative path for its own "main" also solved this problem. Changing these two to require("can-cid")... made this error go away on a project we were seeing it on.

https://github.com/canjs/can-cid/blob/161fecf50e80f6a28ead9988ab956afeaa1ff93d/map/map.js#L3

https://github.com/canjs/can-cid/blob/161fecf50e80f6a28ead9988ab956afeaa1ff93d/set/set.js#L2

Should a project be able to import its own main using relative paths, @matthewp ?

@phillipskevin
Copy link

Doing this in a simple project (outside documentjs) works fine, so I understand it is documentjs that is causing the problem with its build setup. Ignore my previous question.

@ablanco
Copy link

ablanco commented Jan 25, 2018

I'm also seeing this issue, I'm using the 0.5.1
To make sure it wasn't an issue with my project, I've done the same as @danguilherme and created a brand new package with only documentcss, and it fails

@DreaminDani
Copy link

This also happened to me and I cannot figure out how to fix this. Is there a workaround?

@sebs
Copy link

sebs commented Apr 17, 2018

same here fails for a new project, another "living stlye guide generator" that does just does everything, but work

@matthewp
Copy link
Contributor Author

@sebs it's an open source project, submit a fix.

@rucquo-a
Copy link

rucquo-a commented May 9, 2018

Hello,

I've been very annoyed by this error recently and I've searched what I could find in my installed modules.

It seems can-cid's security check is very drastic and not compliant at all when called twice (as expected with this error message), however I don't see where documentjs calls it.

I know nothing of can-cid's architecture but I tweaked the security off to see how my project would react, and it looks all ok, but I still have no clue about why this error is thrown.

The tweak is very simple btw, it's only a condition change in the last if in yourProject/node_modules/can-cid/can-cid.js so it enters the else execution.

Update : After removing the security in can-cid, my project didn't fail but on all the ".catch()" that npm asked me to put on asynchronous functions. After removing them, I was able to run again my project, even after can-cid reset. Hope this helps. 🤞

@justinbmeyer
Copy link
Member

Sorry. We’ve been unable to prioritize documentjs development.

@m-mujica m-mujica assigned m-mujica and unassigned imaustink Jun 17, 2018
m-mujica added a commit that referenced this issue Jun 17, 2018
1. Give the build project a package.json with all of its deps
2. Install the dependencies in the build folder
3. Run the build

Closes #282
@matthewp
Copy link
Contributor Author

Should be fixed in https://github.com/bitovi/documentjs/releases/tag/v0.5.2

@sebs
Copy link

sebs commented Jun 18, 2018

Thanks! ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests