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

Please let tns continue if it encounters a "does not satisfy its siblings' peerDependencies requirements!" #2056

Closed
NathanWalker opened this issue Sep 14, 2016 · 14 comments
Assignees
Labels
Milestone

Comments

@NathanWalker
Copy link
Contributor

In 99% of the cases, I can almost guarantee that installing packages where one package does not satisfy "its siblings' peerDependencies", the app will still run.

And besides that, managing dependencies should be a burden for the developer.
Right now, tns will fail before it even starts if it encounters some sibling peerDependency issue.
This is very frustrating.

Example:

Unable to install dependencies. Make sure your package.json is valid and all dependencies are correct. Error is: The package rxjs@5.0.0-beta.12 does not satisfy its siblings' peerDependencies requirements!

@tzraikov
Copy link
Contributor

@NathanWalker: NativeScript CLI just calls the npm install command. The latter generates this message. Currently the CLI implementation uses an older version of npm. The situation should improve when we remove this dependency.

@tzraikov tzraikov added feature and removed question labels Sep 21, 2016
@NathanWalker
Copy link
Contributor Author

NathanWalker commented Sep 28, 2016

This bit me again today :( ... Any ETA on this pretty frustrating situation?

I need to use some bleeding edge npm versions which will cause peer dependency warning like above, however the code runs fine. Just need the cli to not stop dead cold when this happens, but instead continue along with the build/run.

@bbultman
Copy link

Seconded, this is super frustrating. We're evaluating {N} right now, and this is preventing us from going forward.

@rosen-vladimirov
Copy link
Contributor

Hey, @NathanWalker , @bbultman can you give me exact steps to reproduce the issue on my side? Also can you send us the output of tns build <platform> --log trace when the command fails, so we'll be able to investigate the logs on our side.

@bbultman
Copy link

bbultman commented Sep 29, 2016

@rosen-vladimirov

tns --version
2.3.0

git clone git@github.com:NathanWalker/angular2-seed-advanced.git
cd angular2-seed-advcanced
npm install
cd nativescript
tns build android --log trace

Results in...

log_trace.txt

@NathanWalker
Copy link
Contributor Author

@bbultman precisely thank you.

@rosen-vladimirov This is a critical issue if it could be escalated... please let us know as soon as you know something.

@NathanWalker
Copy link
Contributor Author

@rosen-vladimirov Additionally if there is any temporary workaround to make this work right away, please let me know... hoping :)

@valentinstoychev
Copy link

@NathanWalker - we are investigating Nathan :). It's an npm version problem, we should see how to provide you with a workaround, but also to find a long term solution.

@rosen-vladimirov
Copy link
Contributor

Hey guys,
First of all thank you for sharing the exact steps to reproduce. My problem was that I've been trying to reproduce the problem on Windows. Strangely npm does not fail with the same error code and continues the execution. However on Mac OS X and Linux, I've successfully reproduced the error and I was able to dig into it and what's causing it, so here are the details.
There's a huge difference in the way npm2 and npm3 work with PeerDependencies. As you know, NativeScript CLI depends on npm2 and internally calls npm install when it finds out that some of the dependencies described in the project's package.json are not installed. So this call fails with error code EPEERINVALID and CLI breaks the execution.
So what I've tried is to manually call npm install and after that call tns build android. Strangely, CLI tried to install the dependencies again... It turned out there's an issue in the code that verifies all dependencies are installed - it didn't work correctly with scoped dependencies, so CLI has been callingnpm install on each project prepare (build, run, etc.). This issue had been resolved in #2086.
After merging it I was able to call npm install manually and call tns build android after that. CLI didn't call npm install and the project is successfully built.

I've continued my research and I've noticed that in npm3 the peer dependencies are not automatically installed and missing them in the project produces just warnings. At the moment we are unable to update CLI's dependency of npm to 3.x.x as there are some issues in the code that moves packages from node_modules to platforms/<platform> directory. Anyway, once we are able to use npm 3, the errors will be just warnings, so we've discussed possible workarounds that can be applied immediately. We've decided to catch all EPEERINVALID errors and show them as warnings. Here's the PR that applies this behavior: #2087

So this issue is resolved in master branch of CLI. You can try it on your side 😉
In case you cannot use the master branch for some reason, you can manually edit the code of NativeScript CLI on your side (use this command to find out where cli is installed)

ls -l `which tns`

And in the installation dir navigate to lib/services directory and open platform-service.js file. Search for PlatformService.prototype.preparePlatform method and replace the line:

_this.$errors.failWithoutHelp("Unable to install dependencies. Make sure your package.json is valid and all dependencies are correct. Error is: " + err.message);

with

_this.$logger.warn("Unable to install dependencies. Make sure your package.json is valid and all dependencies are correct. Error is: " + err.message);

This way you'll see only warnings in such case ;)

@bbultman
Copy link

bbultman commented Sep 30, 2016

Awesome, thanks @rosen-vladimirov

I'll test it out directly.

Update:

Current master (70ebb32) works as described, great work!

@rosen-vladimirov
Copy link
Contributor

Hey @bbultman ,
I've just tried the exact steps you've provided with the latest master branch and it worked on my side.
May I ask you how did you get the latest master branch? Did you transpile the code (executing grunt rebuild in the root of the CLI should do this)?

@bbultman
Copy link

@rosen-vladimirov My bad, you're totally correct! I neglected to transpile.

Master works fine!

@rosen-vladimirov
Copy link
Contributor

@NathanWalker I've also found another workaround that you can use in your scripts. Instead of calling tns emulate android, you can call npm install && tns emulate android --disableNpmInstall
This will disable the installation from CLI, so there will be no errors, so the process will continue.
This workaround will work with CLI's version from npm :)

@NathanWalker
Copy link
Contributor Author

Thank you @rosen-vladimirov that works! 👍

I'll use that in the interim until next release.

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

7 participants