-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
a couple of more commands to avoid dependency hell #1
Comments
Thanks for submitting this issue. I cover karma installation issues later in the book and thought I had updated everywhere earlier that required a specific karma version. I'm glad you're enjoying the book. Hopefully there aren't too many other problems like these after the karma installation. |
After the commands above I run I also tried just to see what happens putting * in the place of the versions in package.json and installing. Everything installed successfully but the jshint test produced errors like "ES5 something is added automatically" and complaining I don't have "use strict" on places where I have it. So I decided to stick with the proper versions from the book. But that was just for testing and learning more about node and npm. I remember another small thing that I had to take care of: I installed the latest version of var cookieParser = require('cookie-parser');
var session = require('cookie-session');
...
app.use(cookieParser());
app.use(session({secret: 'SECRET'})); in the place of: app.use(express.cookieParser());
app.use(express.session({secret: 'SECRET'})); I think the express generator already provided And the other thing is about As a whole these things are nothing that can't be solved after a 5min Google search but I wanted to be exhaustive in my reply here :) I don't believe there will be heart breaking probs from now on and it will be fun for me to check what changed between the versions of the tools. Keep up the good work! |
It sounds like you're doing everything right (trying out the tools, that is). The issue you had with jshint complaining about ES5 syntax can be fixed by removing the I have experienced the same thing with mocha, and I believe an update of mocha fixed the problem. Either that or I switched to using chai.js's assert over the node API's assert. One thing to be careful of with your update of express.js is that Express 3 and Express 4 may have different APIs or breaking changes that may have been used in the sample code. Check out the migration docs so you're aware of those changes if you see them in the code. Here's an interesting anecdote about open source version upgrades that I don't remember putting in the book. My previous position was at Expedia, where my team was creating a CMS for internal use. It was written in Scala with AngularJS and ui.bootstrap on the frontend. At one point, someone decided to upgrade from ui.bootstrap 0.9.0 to ui.bootstrap 0.11.0. We were using Bootstrap 2.3.x and whoever did this seemingly harmless upgrade didn't check the documentation for 0.11.0 (which is somewhat hidden):
We ended up having to update Bootstrap to 3.0. It wasn't a huge deal, but it took something like two days when we thought the original task would only take an hour or so. |
First I want to make one correction of the node version I picked in my last comment: I said before that I installed the older version of node: 0.10.2. But then I decided to repeat the process with karma and this time I received too many new errors with other packages. So I went back to 0.10.29 and everything is working well now like before. I am using nodejs/mongodb under Win8 64bit as my laptop and tablet came with it and I paid for the thing but at the office(and my dedicated server) I am an Ubuntu guy and I also use a lot Vagrant and VirtualBox at home. I will install Ubuntu at home in the next months. My point is that for now node behaves very well under Windows so I think there are no problems with the packages because of that. Don't bother much with my tests in package.json as I am forcing all new versions in my post above just for fun. However I've made a repo on my GitLab which can be cloned (https://gitlab.iliyan-trifonov.com/node-js/yfa-node-test-versions.git) I left the jshint package at its original version. $ grunt
Running "env:test" (env) task
Running "jshint:app" (jshint) task
src\app.js
>> ES5 option is now set per default
src\public\javascripts\app.js
>> ES5 option is now set per default
src\public\javascripts\controllers.js
>> ES5 option is now set per default
38 |};
^ Missing "use strict" statement.
46 |};
^ Missing "use strict" statement.
65 |};
^ Missing "use strict" statement.
75 |};
^ Missing "use strict" statement.
src\public\javascripts\directives.js
>> ES5 option is now set per default
1 |/*jshint unused:false */
^ ES5 option is now set per default
src\public\javascripts\filters.js
>> ES5 option is now set per default
src\public\javascripts\main.js
>> ES5 option is now set per default
src\public\javascripts\services.js
>> ES5 option is now set per default
src\routes\index.js
>> ES5 option is now set per default
src\routes\resource.js
>> ES5 option is now set per default
>> 14 errors in 9 files
Warning: Task "jshint:app" failed. Use --force to continue.
Aborted due to warnings. I've set I also tried I've found that I can check local package versions with I've also found that with I wanted to congratulate you with the choice of an IDE(WebStorm). I personally use PHPStorm since 2 years and I am very happy with it. It's working with node/angular too. I also was celebrating when I heard that the new Android studio is using IDEA :) And the story with Bootstrap3 reminded me of my own troubles when I started with Bootstrap2 and then version 3 came. The same happens with Laravel 4->5 now but I will put JavaScript on prio until I am able to do my own MEAN stack sites. That's it for now. I better go back to the book and continue with the next chapters :) |
One more thing about the I've discovered that the required version Then I've tried installing with I'll be putting here other packages(if any) that I had troubles with(and solutions). |
I just tried all things we discussed here under Ubuntu 14.04 with node 0.12.0 installed with nvm and everything behaves the same as my original tests under Win8. The only difference: under Linux tests are running way faster. |
I've noticed that tests run faster under Linux also. I recently switched to OS X, and tests seem to run more quickly on my Macbook Pro 2.4 GHz Intel Core i5 (8GB RAM) than they did on my previous machine, a System76 Pangolin Performance 2.30GHz Intel Core i7 (16GB RAM). I'm wondering if any issues you've been having with the different versions of node could be related to nvm. I don't want to knock Tim Caswell because I think he's awesome and he's contributed a lot to the community, but I've never had a great experience with nvm (or with n). It's been a while, but I believe most of my issues were related to permissions when installing modules. I now prefer nave, which is written and maintained by the same guy that wrote and maintains npm and npmjs.org. I'm not sure if nvm and nave can run side by side, but if you have a lot of problems that sound like permissions (directory not empty, cannot overwrite, etc.) I'd try nave. If you're still getting errors about a missing If you're using WebStorm, you can also configure it to use the .jshintrc and report issues or suggestions within the editor. The quickest way to find the setting is to open WebStorm's preferences and search for jshint: The npm command line tool is pretty powerful and it takes some getting used to. Check out the documentation for npm view. You can quickly get a list of versions for jshint, for example, with:
…where If you install underscore-cli, you can process JSON directly from the command line. If you're familiar with underscore, this would be very useful. If you're not familiar with underscore, it doesn't hurt to get familiar with it since it enables functional programming with JavaScript. To get the most recent version of an npm module:
Then, you can install the specific version: I'll check out your linked repo tonight or tomorrow. Thanks for sharing it. |
Thank you for guiding me through the process! I've learned a lot reading the book so far and following your advice here. I continue with the book. I take my time to write the code, test it, check if there is an error, rest, look on the net to get used to for example mocha and mongoose today. I am also checking the tools you provided here like underscore and chai. I am feeling more confident every day and I am writing down any extra changes I make. I wanted to give you my other link where I commit step by step the code from the book: https://gitlab.iliyan-trifonov.com/node-js/yfa-node . It's completely working so far and includes the local karma version setting from my first comment above. I am updating it a little every day and my progress can be checked there. |
It took me a little longer to check out your fork than I thought it would. I received an email about a prior obligation for a book review and I had to complete it on a short deadline. I tried your fork under node 0.10.20, 0.11.9, and 0.12.0 and I couldn't reproduce the jshint problem. It's possible that some dependency wasn't properly updated while switching between different versions of node. I'm using jshint 2.3.0. To be safe, you can remove the local I know there's also a problem with older versions of npm when you install packages from current revisions. It has something to do with semantic versioning patterns that are supported in the newer versions of npm. I don't think it's an issue if you're running npm 2.x, but if you're running 1.3.x or 1.4.x, you may have problems pulling newer versions of packages. You can, interestingly, upgrade npm using npm:
I don't recall how the |
Thank you for checking my repo. But I've got some experience already and after you told me what to do in the previous comments I decided to do it now. I also scrolled the book to the bottom to see if I will install additional packages in the near future and I think only the socket.io package will be needed but from this point since I managed to work with the karma packages I have only successes and I don't have problems. I've just put the jshint upgrade changes on the repo and they can be seen here https://gitlab.iliyan-trifonov.com/node-js/yfa-node/commit/1ce329a1bcabb26a96734b6c67efb9d63efb9974 I want to write some stuff I've done so far later here. Most of it is just interesting things I discover and maybe 1-2 things connected to the project. I'll compile a small list later today and put it here. |
Hello, I will put here my settings and things that others may find interesting. I want to tell that I am following the code in the book 1:1 I am on the API chapter(node) and still have a long way to walk. My current configuration is: Ubuntu 14.04.2 LTS 64bit
node v0.10.36
npm 1.4.28
current modules in the project
$ npm ls --dept 0
[email protected] /home/iliyan/WORK/nodejs/yfa-node
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected] My node is installed with(apt): curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential Install Interesting things I've found while checking different
With all this I consider my problems with the modules are solved. Thank you! :) |
First thank you for the good book! :)
I've reached the place in the book where we install karma and jshint globally and also install the skeleton yfa project's dependencies.
I've received dependency errors and started debugging.
The errors provided a very good information about what dependency needs a newer version than the one we provide in
karma@...
Using my experience with the PHP's composer I realised that karma's package at this specific version is looking for the latest version of one of its dependencies.
I also knew that if I install this dependency before karma, it will be used instead of the latest one.
The same thing happened with the local yfa packages.
I just picked older versions of the dependencies without researching them thoroughly by only checking with
npm show 'package' versions
These are the commands I used. Maybe there is a better way but I leave them here as a reference to other people like me if they happen to have the same problem:
I'm planning later to modify a little package.json to have this automatically for the local packages.
The text was updated successfully, but these errors were encountered: