bahmutov/next-update

Error: duplicate properties found

Closed this issue · 7 comments

I'm just trying next-update for the first time and have encountered this error.

$ next-update
next-update@3.5.3
 - Tests if module's dependencies can be updated to the newer version without breaking the tests
 installed in folder /Users/jmn42/.nvm/versions/node/v6.10.2/lib/node_modules/next-update
checking if the current state works
up to date in 6.943s
/Users/jmn42/.nvm/versions/node/v6.10.2/lib/node_modules/next-update/node_modules/deps-ok/src/utils.js:36
      throw new Error('duplicate properties found: ' + common);
      ^

Error: duplicate properties found: @sky-uk/organisms,react,react-dom,react-redux,react-router,redux,redux-thunk
    at /Users/jmn42/.nvm/versions/node/v6.10.2/lib/node_modules/next-update/node_modules/deps-ok/src/utils.js:36:13
    at Array.forEach (native)
    at Object.getAllDependencies (/Users/jmn42/.nvm/versions/node/v6.10.2/lib/node_modules/next-update/node_modules/deps-ok/src/utils.js:29:14)
    at checkTopLevelNpmDependencies (/Users/jmn42/.nvm/versions/node/v6.10.2/lib/node_modules/next-update/node_modules/deps-ok/src/check-npm-file.js:16:20)
    at checkTopLevelNpmDependencies (/Users/jmn42/.nvm/versions/node/v6.10.2/lib/node_modules/next-update/node_modules/deps-ok/src/check-npm-package.js:12:37)
    at checkDependenciesInFolder (/Users/jmn42/.nvm/versions/node/v6.10.2/lib/node_modules/next-update/node_modules/deps-ok/src/check-folder.js:30:10)
    at /Users/jmn42/.nvm/versions/node/v6.10.2/lib/node_modules/next-update/src/next-update.js:47:9
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

I would try to push further before opening an issue but I'm not clear what "duplicate properties found" means in this context. The error refers to @sky-uk/organisms,react,react-dom,react-redux,react-router,redux,redux-thunk but they are unique.

After first encountering this, I ran rm -rf package-lock.json node_modules && npm install before retrying, but encountered the same error.

I have the following installed

osx@10.11.16
next-update@3.5.3
npm@5.3.0
node@6.10.2

Please let me know if there is any more information I can give you, thanks.

Hmm, that is very weird. This error (I should clarify it better) happens when you have same dependency like react in both production and devDependencies

That makes sense and I see that the packages listed appear in both dependencies and peerDependencies – I will ask around here to find out why that is.

I will close this to keep your issues clean and reopen if there's a need to later.

Thanks a lot.

For anyone else finding this issue who also needs to keep peerDependencies for whatever reason, you can just rename peerDependencies while you run next-update, then change it back afterwards.

Remember to update the peerDependencies as well if needed.

@JamieMason is next-update missing checking and updating peerDependencies? I can easily add this to the tool.

I think the tool is fine. This project I'm on chooses to list some packages in both dependencies and also peerDependencies and that is what causes the error in the OP.

To work around that I just renamed peerDependencies to eg !peerDependencies so next-update can't see it, then put it back again after.

Gotcha, double listing of deps is weird, I agree this is an edge case that my package linting will not allow. But whatever... 👍

yeah this is pretty off-piste. There are applications here which are mounted into another and I think this is part of that. Not something for next-update to worry about but I posted the workaround incase any other lost souls stumble on it 👍