Giter Club home page Giter Club logo

react-essentials's Introduction

Book cover

React.js Essentials

Have you read React.js Essentials book yet? Share your comments, questions, ideas, thoughts.

Throughout the book you will be building a React.js app called Snapterest. Here is live version of Snapterest: http://fedosejev.github.io/react-essentials-project/

Join our Facebook Page

https://www.facebook.com/groups/ReactEssentials/

I would really appreciate your help

Can you please write a short review for the book on Amazon? Thank you!

Where to get your copy?

Q/A

Ask me any question on Snapchat - my username is artemij.

I get SyntaxError: .../app.js: Unexpected token when I run gulp command. What should I do?

This is due to some breaking changes made in babelify version 7. The book uses babelify version 6 - if you choose to use version 6 as well then please do the following.

If you choose to use babelify version 7, then please see this comment.

Can I have ES6 version of Snapterest?

Yes! Here it is. Special thanks to Jason Rogers who converted Snapterest to ES6 syntax!

Can I see Snapterest in action?

Yes! http://fedosejev.github.io/react-essentials-project/

How to deploy a stand alone React.js application described in the book?

You can deploy it on GitHub Pages.

Have you seen your book on Reddit?

Yes.

Can I have another example of using React.js with Flux?

Sure, check my Shopping List example.

Questions, errors, ideas or thoughts?

Check updates or create a new issue.

Superheroes

Special thanks to @magomimmo, @ttanzer, @rickhaffey, @RenatKunafin, @blitzd, @duanec, @gerturo who helped other readers to solve various issues!

Author

Artemij Fedosejev

Artemij Fedosejev is a technical lead living in London, United Kingdom. He is a self-taught web developer who has been a web developer since the early 2000s. Artemij earned his BSc in Computer Science from University College Cork, Ireland. He participated in the IGNITE Graduate Business Innovation Programme, where he built and launched a website that received the Most Innovative Project award.

After graduation, Artemij moved to London to help local start-up companies build their products. He worked with JavaScript, Node.js, HTML5, CSS3, and other modern web technologies. After gaining some experience in the start-up industry, Artemij was presented with an opportunity to join Imperial College, London, work on a research and development, project and take leadership in creating frontends for a couple of web applications in the public health space. He played a key role in creating frontend architecture using React.js and Flux for WGSA.net and Microreact.org.

Snapchat: artemij

Thank you

This book is written for you and I appreciate so much for you investing your time, money and effort into reading this book.

Keep learning and growing!

Artemij
[email protected]

react-essentials's People

Contributors

fedosejev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-essentials's Issues

Where are 'tweets' coming from?

On page 51, the prop 'tweets' is being passed to the Collection component - where is 'tweets' coming from? On page 55 it says "This refers to our current collection of tweets", but doesn't say where it is coming from.

JSX is not working

Hello,

In the 2nd chapter I tried the example with JSX and the .transform(babelify) function call and I have an error when I run gulp

events.js:85
throw er; // Unhandled 'error' event
SyntaxError:

It begin at var listOfItems = **<**ul

I found the solution on issue #14

snapkite start problem

hi, i get following error: on npm start

npm ERR! Error: ENOENT, open '/Users/patrick/ReactNode/playground/package.json'
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues

npm ERR! System Darwin 15.0.0
npm ERR! command "node" "/usr/local/bin/npm" "start"
npm ERR! cwd /Users/patrick/ReactNode/playground
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! path /Users/patrick/ReactNode/playground/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/patrick/ReactNode/playground/npm-debug.log
npm ERR! not ok code 0

thanks for any hints.

Connect to node and menu structue

Hi Artemij.

Thanks for your book. It's very clear and easy to read.

Two questios:

  • To connect to node (server). Some advise?
  • For a simple menu and submenus. What would be the components structure? What would be the smallest component?

Thanks.

How to deploy the app?

I've read through the book but there doesn't seem much info on how we could deploy the app in a production environment, I tried to push it to heroku but it detected it as a nodejs app which was not fully setup. I want to separate my backend and front end code as two separate code bases, and the reactjs app would use jquery ajax to make API calls, so my question is how can I deploy a stand alone reactjs app?

Getting error in first chapter when running npm start

here is the npm log----
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'owner',
1 verbose cli 'ls',
1 verbose cli 'snapkite-engine' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink /usr/bin/node
5 silly mapToRegistry name snapkite-engine
6 silly mapToRegistry using default registry
7 silly mapToRegistry registry https://registry.npmjs.org/
8 silly mapToRegistry uri https://registry.npmjs.org/snapkite-engine
9 verbose request uri https://registry.npmjs.org/snapkite-engine
10 verbose request no auth needed
11 info attempt registry request try #1 at 14:23:17
12 verbose request id dcd250294389cade
13 http request GET https://registry.npmjs.org/snapkite-engine
14 http 404 https://registry.npmjs.org/snapkite-engine
15 verbose headers { 'content-type': 'application/json',
15 verbose headers 'cache-control': 'max-age=0',
15 verbose headers 'content-length': '2',
15 verbose headers 'accept-ranges': 'bytes',
15 verbose headers date: 'Wed, 23 Sep 2015 08:53:19 GMT',
15 verbose headers via: '1.1 varnish',
15 verbose headers age: '0',
15 verbose headers connection: 'keep-alive',
15 verbose headers 'x-served-by': 'cache-sin6921-SIN',
15 verbose headers 'x-cache': 'MISS',
15 verbose headers 'x-cache-hits': '0',
15 verbose headers 'x-timer': 'S1442998398.298257,VS0,VE858' }
16 silly get cb [ 404,
16 silly get { 'content-type': 'application/json',
16 silly get 'cache-control': 'max-age=0',
16 silly get 'content-length': '2',
16 silly get 'accept-ranges': 'bytes',
16 silly get date: 'Wed, 23 Sep 2015 08:53:19 GMT',
16 silly get via: '1.1 varnish',
16 silly get age: '0',
16 silly get connection: 'keep-alive',
16 silly get 'x-served-by': 'cache-sin6921-SIN',
16 silly get 'x-cache': 'MISS',
16 silly get 'x-cache-hits': '0',
16 silly get 'x-timer': 'S1442998398.298257,VS0,VE858' } ]
17 error owner ls Couldn't get owner data snapkite-engine
18 verbose stack Error: Registry returned 404 for GET on https://registry.npmjs.org/snapkite-engine
18 verbose stack at CachingRegistryClient. (/usr/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:239:14)
18 verbose stack at Request._callback (/usr/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:170:14)
18 verbose stack at Request.self.callback (/usr/lib/node_modules/npm/node_modules/request/request.js:354:22)
18 verbose stack at Request.emit (events.js:110:17)
18 verbose stack at Request. (/usr/lib/node_modules/npm/node_modules/request/request.js:1207:14)
18 verbose stack at Request.emit (events.js:129:20)
18 verbose stack at IncomingMessage. (/usr/lib/node_modules/npm/node_modules/request/request.js:1153:12)
18 verbose stack at IncomingMessage.emit (events.js:129:20)
18 verbose stack at _stream_readable.js:908:16
18 verbose stack at process._tickCallback (node.js:355:11)
19 verbose statusCode 404
20 verbose pkgid snapkite-engine
21 verbose cwd /home/bern/snapkite-engine
22 error Linux 3.19.0-29-generic
23 error argv "/usr/bin/node" "/usr/bin/npm" "owner" "ls" "snapkite-engine"
24 error node v0.12.7
25 error npm v2.11.3
26 error code E404
27 error 404 Registry returned 404 for GET on https://registry.npmjs.org/snapkite-engine
27 error 404
27 error 404 'snapkite-engine' is not in the npm registry.
27 error 404 You should bug the author to publish it (or use the name yourself!)
27 error 404
27 error 404 Note that you can also install from a
27 error 404 tarball, folder, http url, or git url.
28 verbose exit [ 1, true ]

No Tweets showing up

I'm about to go to snapkite-engine and run 'npm start and I get the message [Snapkite][Socket] Listening on port 3000.

I'm also about to run gulp and get no errors, but when I open up the index.html file I don't see any photos show and and I get this error in the console. Any suggestions?

Failed to clear temp storage: It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources. SecurityError

Issue with Jest and renderIntoDocument

Hi there, I've run into an odd issue with the unit tests. For the most part they work, but the renderIntoDocument seems to choke.

Here's the code for the test:

jest.dontMock('../Header.react');

describe('Header component', function () {

it('renders provided header text', function () {
    var React = require('react');
    var ReactDOM = require('react-dom');
    var TestUtils = require('react-addons-test-utils');
    var Header = require('../Header.react');


    var header = TestUtils.renderIntoDocument(
        <Header text="Testing..." />
    );

    var actualHeaderText = ReactDOM.findDOMNode(header).textContent;

    expect(actualHeaderText).toBe("Testing...");

    var defaultHeader = TestUtils.renderIntoDocument(
        <Header />
    );

    var actualDefaultHeaderText = ReactDOM.findDOMNode(defaultHeader).textContent;

    expect(actualDefaultHeaderText).toBe("Default header");
    expect(actualDefaultHeaderText).not.toBe(actualHeaderText);

});

});

Here are the relevant lines from the dev dependencies in package,json:

"jest-cli": "^0.7.1",
"react-addons-test-utils": "^0.14.2",

Most of the other test succeed but this one (and the button tests) throw a syntax error. Unexpected token <. I assume is choking on the JSX. Have you seen this before?

Chapter 1 - Error starting snapkite engine

Any help is greatly appreciated. Here's the error message hat is getting output.

[email protected] start /Users/bchandonnet/Sites/learning/snapkite-engine
node app.js

module.js:338
throw err;
^
Error: Cannot find module './config.json'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/Users/bchandonnet/Sites/learning/snapkite-engine/app.js:1:85)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)

npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! This is most likely a problem with the snapkite-engine package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get their info via:
npm ERR! npm owner ls snapkite-engine
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/bchandonnet/Sites/learning/snapkite-engine/npm-debug.log

Header-test fails

Following along in the book I got to the tests in Ch 8 for the Header and Button React components.

First, the react-addons-test-utils complained that react 0.14.1 was not sufficient - it wanted 0.14.2. I updated both react and react-dom to 0.14.2 - so far so good.

At that point I could still run the prior tests on the non-React components. Now when I add my test for Header I get this in the console:

npm test

> [email protected] test /Users/mfromin/mean-web-dev/snapterest
> jest


  == NOTICE: ==
    Node and io.js will be merging. http://bit.ly/1dOjLVK
    On August 1st, 2015, Jest v0.5.x will work only on io.js until the merger is complete
    Legacy v0.4.x for Node 0.10.x will still be available on
    on npm and from the "0.4.x" branch on GitHub.

Using Jest CLI v0.4.18
 PASS  source/utils/__tests__/TweetUtils-test.js (0.598s)
 FAIL  source/components/__tests__/Header-test.js
Error: Worker process exited before responding! exit code: null, exit signal: SIGSEGV
stderr:


A worker process has quit unexpectedly! This is bad news, shutting down now!
npm ERR! Test failed.  See above for more details.

So I then commented out all the code in the test:

jest.dontMock('../Header.react');

describe('Header component', function () {
    it('renders provided header text', function () {
        //var React = require('react');
        //var ReactDOM = require('react-dom');
        //var TestUtils = require('react-addons-test-utils');
        //var Header = require('../Header.react');
        //
        //var header = TestUtils.renderIntoDocument(<Header text="Testing..."/>);
        //var actualHeaderText = ReactDOM.findDOMNode(header).textContent;
        //
        //expect(actualHeaderText).toBe('Testing...');
        //
        //var defaultheader = TestUtils.renderIntoDocument(<Header />);
        //var actualDefaultHeaderText = ReactDM.findDOMNode(defaultheader).textContent;
        //expect(actualDefaultHeaderText).toBe('Default header');
    });
});

...and this of course PASSES. The moment I uncomment any of the require statements I get the aforementioned error.

Thoughts?

Why need ReactDOM ?

Hi ,

What is the requirement of having ReactDOM , can't we just use React.render ?

var React = require('react');
var ReactDOM = require('react-dom');
var reactElement = React.createElement('h1');
ReactDOM.render(reactElement, document.getElementById('react-application'));

Snapkite-engine not building

I'm receiving node-gyp build errors on some of the sub-dependencies of Snapkite. For example, the Kerberos module won't build (it is a dependency of MongoDB, which in turn is a dependency of Mongoose). I have determined that I can make Kerberos build successfully if I simply upgrade it from 0.0.4 to the latest 0.0.17. Unfortunately, this in turn means I must also have newer versions of MongoDB and/or Mongoose. In short, Snapkite is becoming out-of-date.

My environment is Windows 10, Node.js 5.1.0 (x64) and Visual Studio 2015 Community Edition (RTM). I have followed the instructions given here: https://github.com/nodejs/node-gyp#installation. The one difference I have from that guide, is that I installed the Windows 10 SDK, instead of the Windows 7 SDK.

My system also has had SQL Server installed, which I believe installed the C++ 2012 CRT. This might be an ingredient that causes the 0.0.04 version of Kerberos to fail its build. Thus I also tried to build Kerberos 0.0.4 directly with this command:

node-gyp rebuild --msvs_version=2015

That approach did not work. Ultimately, a later version of the Kerberos module resolves the issue, which suggests that is where the real issue is (and thus the issue in turn is caused by SnapKite being out of date).

SnapKite has four module sub-dependencies that are not building for me, but here is the output from Kerberos as an example of the failures:

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
kerberos.cc
worker.cc
security_buffer.cc
security_buffer_descriptor.cc
security_context.cc
security_credentials.cc
c:\users\costcopc\documents\axiscode\yo\nodegits\snapkite-engine\node_modules\kerberos\lib\win32\worker.h(17): error C3
646: 'request': unknown override specifier (compiling source file ..\lib\win32\worker.cc) [C:\Users\costcopc\Documents
AxisCode\YO\nodegits\snapkite-engine\node_modules\kerberos\build\kerberos.vcxproj]
c:\users\costcopc\documents\axiscode\yo\nodegits\snapkite-engine\node_modules\kerberos\lib\win32\worker.h(17): error C4
430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\lib\win32\worker.cc) [C:\Users\costcopc\Documents\AxisCode\YO\nodegits\snapkite-engine\node_modules\kerberos\build\kerberos.vcxpro
j]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sspi.h(86): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\lib\win32\wrappers\security_context.cc) [C:\Users\costcopc\Documents\AxisCode\YO\nodegits\snapkite-engine\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sspi.h(86): error C2146: syntax error: missing ';' before identifier 'SEC_WCHAR' (compiling source file ..\lib\win32\wrappers\security_context.cc) [C:\Users\costcopc\Documents\AxisCode\YO\nodegits\snapkite-engine\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sspi.h(87): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\lib\win32\wrappers\security_context.cc) [C:\Users\costcopc\Documents\AxisCode\YO\nodegits\snapkite-engine\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sspi.h(87): error C2146: syntax error: missing ';' before identifier 'SEC_CHAR' (compiling source file ..\lib\win32\wrappers\security_context.cc) [C:\Users\costcopc\Documents\AxisCode
\YO\nodegits\snapkite-engine\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sspi.h(90): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file ..\lib\win32\wrappers\security_context.cc) [C:\Users\costcopc\Documents\AxisCode\YO\nodegits\snapkite-engine\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sspi.h(90): error C2146: syntax error: missing ';' before identifier 'SECURITY_STATUS' (compiling source file ..\lib\win32\wrappers\security_context.cc) [C:\Users\costcopc\Documents\AxisCode\YO\nodegits\snapkite-engine\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sspi.h(109): error C2143: syntax error: missing ';' before '*' (compiling source file ..\lib\win32\wrappers\security_context.cc) [C:\Users\costcopc\Documents\AxisCode\YO\nodegits\snapkite-engine\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sspi.h(109): error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int (compiling source file ..\lib\win32\wrappers\security_context.cc) [C:\Users\costcopc\Documents\AxisCode\YO\nodegits\snapkite-engine\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\sspi.h(109): error C2378: 'SEC_CHAR': redefinition; symbol cannot be overloaded with a typedef (compiling source file ..\lib\win32\wrappers\security_context.cc) [C:\Users\costcopc\Documents\AxisCode\YO\nodegits\snapkite-engine\node_modules\kerberos\build\kerberos.vcxproj]

errors with Gulp

I sent this in an email yesterday:

RE: [react-essentials] error on npm start (#15)
Elizabeth Kari
11/03/15
To: fedosejevreact-essentials
I have another question. I threw out my previous version, and started again. Everything seemed to be going fine. Chapter 2, Building With Gulp.js. I followed the instructions for installing Gulp, no problem. The next instruction is npm install --save-dev babelify. No problem. From my terminal: snapterest:$ npm install --save-dev babelify Next up, npm install --save-dev vinyl-source-stream. Again, no problem (from terminal: snapterest:$ npm install --save-dev vinyl-source-stream). I then ran Gulp as instructed, and got the expected result. At this point everything was working as expected. I added the current version of React, the code to app.js, and ran Gulp. I created the element, and had the expected html on screen, but not “


in the developer tools. I continued, but the text is not appearing on screen as expected. At the end of the chapter I double checked mine against your example, and while the code I typed matched, there is a major file discrepancy:

build
gulpfile.js
node_modules
package.json
source

I have the node modules folder in my app, whereas your example does not. Inside my node modules folder:

babelify
browserify
gulp
react
react-dom
vinyl-source-stream

I followed the instructions. If these are not supposed to be in the snapterest folder, and since they're not in yours I'm gathering that is not the case, then where are they supposed to be? How should I proceed?


Having not heard back, I deleted the node modules folder from snapterest. I then reinstalled all those node modules in my main directory. I double checked to make sure the rest of my code was matching yours. After doing so I ran gulp again. Failure:
snapterest:$ gulp
[12:35:44] Using gulpfile ~/snapterest/gulpfile.js
[12:35:44] Starting 'default'...
events.js:141
throw er; // Unhandled 'error' event
^

SyntaxError: /Users/elizabethakari/snapterest/source/app.js: Unexpected token (4:18)
2 | var ReactDOM = require('react-dom');
3 |

4 | var listOfItems =


    | ^
    5 |
  • Item 1

  • 6 |
  • Item 2

  • 7 |
  • Item 3

  • at Parser.pp.raise (/Users/elizabethakari/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/parser/location.js:24:13)
    at Parser.pp.unexpected (/Users/elizabethakari/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/parser/util.js:91:8)
    at Parser.pp.parseExprAtom (/Users/elizabethakari/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:507:12)
    at Parser.pp.parseExprSubscripts (/Users/elizabethakari/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:260:19)
    at Parser.pp.parseMaybeUnary (/Users/elizabethakari/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:240:19)
    at Parser.pp.parseExprOps (/Users/elizabethakari/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:171:19)
    at Parser.pp.parseMaybeConditional (/Users/elizabethakari/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:153:19)
    at Parser.pp.parseMaybeAssign (/Users/elizabethakari/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/parser/expression.js:120:19)
    at Parser.pp.parseVar (/Users/elizabethakari/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:576:24)
    at Parser.pp.parseVarStatement (/Users/elizabethakari/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/parser/statement.js:406:8)
    I have no idea what the problem is. I have put what I have up at https://github.com/catfriend/snapterest

Error running Chapter 4 code...

I copied the code from Github to app.js and Application.react.js, then ran gulp, but received the following error - should I be able to run this code?

gulp_error

Chapter 02 - React doesn't take effect page 22

I run into problem on page 22. It says the html page should be empty and I should open developer tools to find an empty h1-tag. My page is not empty and shows the original text ("I am about to learn the essentials of React.js.") from the index.html file. It hasn't been written over by app.js or anything.

If I run the downloaded code it works fine and shows three list items instead of the original text but I haven't gotten to the end yet. So I tried to copy the code from the example files (except for app.js and snapterest.js) and build again with gulp. I still get the same result. Gulp finishes and I can see the snapterest file is updated. The only difference I can find now is in the versions of babelify and browserify in packages.json. I tried changing them as well and build again. Still no change.

So React doesn't even kick in....

jest-cli version 0.5+ won't work with current version of Node; should require jest-cli <0.5

This isn't an issue with any of the code itself, but it's still an issue that I encountered while working through the book. Posting it here may help others. (It might be also be worth posting a correction to the book's text that makes jest-cli <0.5 a requirement.)

For the tests in Chapter 8, the book uses jest-cli version 0.4.18. However, the current version of jest-cli is 0.5.1, and version 0.5.1 is what will be installed if you enter the exact command presented in Chapter 8 (npm install –-save-dev jest-cli). The major problem here is that any version of jest-cli greater than 0.4 will not support the current version of Node.js (0.12), or any version below that (see this link for some discussion: jestjs/jest#243), and therefore the tests in the book will not work at all. The simplest solution, if you are using Node (and not io.js), is to force installation of jest-cli < 0.5, using a command like this:

npm install --save-dev jest-cli@^0.4

This will install a version of jest-cli >=0.4 and <0.5, and all should work from there.

Creating Twitter Apps not possible from India

Twitter requires users to register a mobile number before they can create any apps.
Since, Twitter doesn't support any mobile carriers in India, its not possible for Indian residents to have access to Twitter apps.

Error in console

warning.js:45 Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of `Application`.warning @ warning.js:45ReactElementValidator.createElement @ ReactElementValidator.js:221render @ Application.react.js:39ReactCompositeComponentMixin._renderValidatedComponentWithoutOwnerOrContext @ ReactCompositeComponent.js:587ReactCompositeComponentMixin._renderValidatedComponent @ ReactCompositeComponent.js:607wrapper @ ReactPerf.js:66ReactCompositeComponentMixin.mountComponent @ ReactCompositeComponent.js:220wrapper @ ReactPerf.js:66ReactReconciler.mountComponent @ ReactReconciler.js:37ReactCompositeComponentMixin.mountComponent @ ReactCompositeComponent.js:225wrapper @ ReactPerf.js:66ReactReconciler.mountComponent @ ReactReconciler.js:37mountComponentIntoNode @ ReactMount.js:266Mixin.perform @ Transaction.js:136batchedMountComponentIntoNode @ ReactMount.js:282Mixin.perform @ Transaction.js:136ReactDefaultBatchingStrategy.batchedUpdates @ ReactDefaultBatchingStrategy.js:62batchedUpdates @ ReactUpdates.js:94ReactMount._renderNewRootComponent @ ReactMount.js:476wrapper @ ReactPerf.js:66ReactMount._renderSubtreeIntoContainer @ ReactMount.js:550ReactMount.render @ ReactMount.js:570wrapper @ ReactPerf.js:66209../components/Application.react @ app.js:5s @ _prelude.js:1e @ _prelude.js:1(anonymous function) @ _prelude.js:1
invariant.js:39 Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of `Application`.

React Dom does not updates

I must have done something wrong, When I make changes in app.js, these changes do not reflect on the index.html as I open it on the browser. The file only updates after I run gulp, so do I have to do that every time I update app.js?

Creating a JSX list of items (chapter 2) throws a parsing error when building with 'gulp'

After writing the JSX code for an unordered list, I've been trying to build the module using 'gulp' command. However, I am getting the following error:

SyntaxError: /path/to/app.js: Unexpected token in the 'transform' directive within the gulpfile.js

61 | var jsxListOfItems = < ul className="list-of-items"> ... < /ul>
at Parser.pp.raise ... // rest of the error stack

My gulp file is written as follows:
var gulp = require('gulp');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');

gulp.task('default', function () {
return browserify('./source/app.js')
.transform(babelify)
.bundle()
.pipe(source('snapterest.js'))
.pipe(gulp.dest('./build/'));
}); //end gulpfile

My app.js has the following code that seems to bring up the issue:

var jsxListOfItems = < ul className="list-of-items">
< li className="item-1">Item 1< /li>
< li className="item-2">Item 2< /li>
< li className="item-3">Item 3< /li>
< /ul>;

// render(element, parent element); - or, 'render what' and 'render where'.
ReactDom.render(jsxListOfItems, document.getElementById('react-application'));

  • this is just standard JSX from what I can see; I've installed all the dependencies without errors as per first chapter of the book, and up until this point everything has been working perfectly, - could you suggest where I've gone wrong here?

Error running chapter 5 code...

I have copied the files from the Chapter 5 directory of Github, run them and get the following error:

react@react-vm:~/snapterest$ sudo gulp
[sudo] password for react:
[13:44:59] Using gulpfile ~/snapterest/gulpfile.js
[13:44:59] Starting 'default'...
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: Cannot find module './Collection.react' from '/home/react/snapterest/source/components'
    at /home/react/snapterest/node_modules/resolve/lib/async.js:55:21
    at load (/home/react/snapterest/node_modules/resolve/lib/async.js:69:43)
    at onex (/home/react/snapterest/node_modules/resolve/lib/async.js:92:31)
    at /home/react/snapterest/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:82:15)

I'm assuming that this is becasue one of the component includes is not present, but why is this not in the Chapter 5 directory of Github? Especially when in the last paragraph on page 69 it says "After running snapterest in a web browser for a few mintes..." - clearly this is not the possible to run the code at this point !? This book is becoming an increasingly frustrating read as I cannot continually make the visual connection between the code and what is rendered when the program is run.

NPM Error!!!

[email protected] start /var/lib/tomcat8/webapps/ROOT/Snapterest/snapkite-engine
node app.js

[Snapkite][Socket] Listening on port 3000

module.js:340
throw err;
^
Error: Cannot find module './config.json'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/var/lib/tomcat8/webapps/ROOT/Snapterest/snapkite-engine/filters/snapkite-filter-is-possibly-sensitive/index.js:1:76)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

npm ERR! [email protected] start: node app.js
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the snapkite-engine package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get their info via:
npm ERR! npm owner ls snapkite-engine
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.2.0-22-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! cwd /var/lib/tomcat8/webapps/ROOT/Snapterest/snapkite-engine
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/lib/tomcat8/webapps/ROOT/Snapterest/snapkite-engine/npm-debug.log
npm ERR! not ok code 0

Error installing snapkite-stream-client

I am using Ubuntu 14.04 LTS 64-bit, and having this error.

➜  snapterest.dev  npm install --save snapkite-stream-client

> [email protected] install /var/www/snapterest.dev/node_modules/bufferutil
> node-gyp rebuild

make: Entering directory `/var/www/snapterest.dev/node_modules/bufferutil/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
make: g++: Command not found
make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 127
make: Leaving directory `/var/www/snapterest.dev/node_modules/bufferutil/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.16.0-55-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/snapterest.dev/node_modules/bufferutil
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1

> [email protected] install /var/www/snapterest.dev/node_modules/utf-8-validate
> node-gyp rebuild

make: Entering directory `/var/www/snapterest.dev/node_modules/utf-8-validate/build'
  CXX(target) Release/obj.target/validation/src/validation.o
make: g++: Command not found
make: *** [Release/obj.target/validation/src/validation.o] Error 127
make: Leaving directory `/var/www/snapterest.dev/node_modules/utf-8-validate/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.16.0-55-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/snapterest.dev/node_modules/utf-8-validate
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

Chapter 7 does not work as specified in book

Hi, I copied from the book and created my own files via the tutorial. Twitter photos appear but no buttons or tweets. I cloned the project and ran Chapter 7 code. Same result in Firefox and Chrome. No buttons or tweets.

First NPM Start

Sams-MacBook-Pro:snapkite-engine White$ npm start

[email protected] start /Users/White/DevBox/snapkite-engine
node app.js

module.js:417
throw err;
^

SyntaxError: /Users/White/DevBox/snapkite-engine/config.json: Unexpected token “
at Object.parse (native)
at Object.Module._extensions..json (module.js:414:27)
at Module.load (module.js:345:32)
at Function.Module._load (module.js:302:12)
at Module.require (module.js:355:17)
at require (internal/module.js:13:17)
at Object. (/Users/White/DevBox/snapkite-engine/app.js:1:23)
at Module._compile (module.js:399:26)
at Object.Module._extensions..js (module.js:406:10)
at Module.load (module.js:345:32)

npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.2.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the snapkite-engine package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get their info via:
npm ERR! npm owner ls snapkite-engine
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/White/DevBox/snapkite-engine/npm-debug.log
npm-debug.pdf

seems like theres an extra " in the config.json but I can't see one, I'll attach this and log, thank you in advance!

config.pdf

Error installing snapkite-stream-client

In chapter 1 I successfully installed snapkite engine and started it. it is currently listening on port 3000.

I'm having an issue starting chapter 5 attempting to run npm install --save snapkite-stream-client.
I do have Visual Studio 2008 installed so I don't know why I'm getting that Can't find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed? error. Is there something else I'm missing?

I'm running a Windows 7 machine.

D:\Repositories\snapterest>npm install --save snapkite-stream-client
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No README data
/
> [email protected] install D:\Repositories\snapterest\node_modules\snapkite-stream-client\node_modules\socket.io-client\node_modules\engine.io-client\node_m
odules\ws\node_modules\utf-8-validate
> node-gyp rebuild


D:\Repositories\snapterest\node_modules\snapkite-stream-client\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
gyp ERR! build error
gyp ERR! stack Error: Can't find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?
gyp ERR! stack     at findMsbuild (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:122:23)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:104:11
gyp ERR! stack     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:73:25)
gyp ERR! stack     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:76:29)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:84:16
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Repositories\snapterest\node_modules\snapkite-stream-client\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

> [email protected] install D:\Repositories\snapterest\node_modules\snapkite-stream-client\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild


D:\Repositories\snapterest\node_modules\snapkite-stream-client\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node  rebuild )
gyp ERR! build error
gyp ERR! stack Error: Can't find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?
gyp ERR! stack     at findMsbuild (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:122:23)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:104:11
gyp ERR! stack     at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:73:25)
gyp ERR! stack     at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:76:29)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:84:16
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Repositories\snapterest\node_modules\snapkite-stream-client\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.2.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
[email protected] node_modules\snapkite-stream-client
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], has
[email protected], [email protected], [email protected], [email protected])

D:\Repositories\snapterest>

Chapter 5 running code in browser

I'm not sure if I'm doing something wrong but in the componentWillMount method section of the chapter it says to run the code in the browser to see the log messages. However this does not work and to make it work I have to create Header.react.js, Collection.react.js and Tweet.react.js files with the basic template of the following as an example:

var React = require("react");

var Tweet = React.createClass({
  render: function() {
    return null;
  }
});

module.exports = Tweet;

I didn't see any mention of this in the book, should this be mentioned for clarity?

Unexpected token error upon running gulp command and using babelify with JSX

Here's the error I'm getting early on in the snapterest demo app:

SyntaxError: /Users/johntabone/Documents/development/snapterest/source/app.js: Unexpected token(3:18)
var React = require('react'); var ReactDOM = require('react-dom');
` var listOfItems =

    It's choking on the < character when declaring the listOfItems element. Any help would be appreciated!

{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }

[email protected] start C:\Ed__temp\snapkite-engine
node app.js

{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version

!!! MONGOOSE WARNING !!!

This is an UNSTABLE release of Mongoose.

Unstable releases are available for preview/testing only.

DO NOT run this in production.

[Snapkite][Socket] Listening on port 3000
[Snapkite][Database] Connected

gulp error when attempting to incorporate JSX in basic Chapter 3 component

My code is as follows:

var React = require('react');
var ReactDOM = require('react-dom');

var ReactClass = React.createClass({
  render: function () {
    return <h1 className = 'header'> ReactComponent </h1>;
  }
});

ReactDOM.render(<ReactClass />, document.getElementById('react-application'));

When I run the gulp from terminal, get the following error:

events.js:85
      throw er; // Unhandled 'error' event
            ^
SyntaxError: /Users/cjurden/Development/Learning/React/Essentials/snapterest/source/app.js: Unexpected token (6:11)
  4 | var ReactClass = React.createClass({
  5 |   render: function () {
> 6 |     return <h1 className = 'header'> ReactComponent </h1>;
    |            ^
  7 |   }
  8 | });
  9 | 

Not sure why it is not recognizing the JSX representation of a very simple React.createElement() call. I have checked to make sure I have .transform(babelify) in my gulpfile and tried wrapping the element in parentheses. I am not sure what else could be the problem. Thanks!

can't start snapkite-engine

[email protected] start /Users/Jean/repos/react-essentials/snapkite-engine
node app.js

module.js:338
throw err;
^
Error: Cannot find module 'socket.io'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at module.exports (/Users/Jean/repos/react-essentials/snapkite-engine/controllers/socket.js:5:15)
at Object. (/Users/Jean/repos/react-essentials/snapkite-engine/app.js:4:34)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! This is most likely a problem with the snapkite-engine package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get their info via:
npm ERR! npm owner ls snapkite-engine
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/Jean/repos/react-essentials/snapkite-engine/npm-debug.log

Chapter 8: Testing React components (pages 129-131).

Hi,

When running npm test after finishing Header-test.js an error is thrown:

$ npm test

> [email protected] test /path/to/snapterest
> jest

Using Jest CLI v0.5.5
 PASS  source/utils/__tests__/TweetUtils-test.js (0.017s)
 PASS  source/utils/__tests__/CollectionUtils-test.js (0.022s)
 FAIL  source/components/__tests__/Header-test.js 
● Runtime Error
SyntaxError: /path/to/snapterest/source/components/__tests__/Header-test.js: Unexpected token <
  at Object.exports.runInContext (vm.js:43:16)
  at JSDomEnvironment.runSourceText (/path/to/snapterest/node_modules/jest-cli/src/JSDomEnvironment.js:86:8)
  at Object.runContentWithLocalBindings (/path/to/snapterest/node_modules/jest-cli/src/lib/utils.js:498:17)
  at Loader._execModule (/path/to/snapterest/node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:236:9)
  at Loader.requireModule (/path/to/snapterest/node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:905:12)
  at jasmineTestRunner (/path/to/snapterest/node_modules/jest-cli/src/jasmineTestRunner/jasmineTestRunner.js:284:16)
  at /path/to/snapterest/node_modules/jest-cli/src/TestRunner.js:375:12

1 test failed, 2 tests passed (3 total)
Run time: 1.011s
npm ERR! Test failed.  See above for more details.

After some digging around I found this link: https://facebook.github.io/jest/docs/tutorial-react.html#setup. I needed to install babel-jest and add this to my package.json file:

"jest": {
    "scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
    "unmockedModulePathPatterns": [
      "<rootDir>/node_modules/react"
    ]
  }

Leaving this here for anyone else who might run into this problem.

Using
node: 4.1.0
npm: 2.14.3
react: 0.14.0-rc1
jest: 0.5.5 (i upgraded to 0.5.7 and got the same error before updating my package.json file)

First RUN npm start

[email protected] start /var/www/snapkite-engine
node app.js

events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1039:14)
at listen (net.js:1061:10)
at Server.listen (net.js:1135:5)
at module.exports (/var/www/snapkite-engine/controllers/socket.js:14:10)
at Object. (/var/www/snapkite-engine/app.js:4:34)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)

npm ERR! Linux 3.19.0-15-generic
npm ERR! argv "node" "/usr/local/bin/npm" "start"
npm ERR! node v0.10.25
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the snapkite-engine package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs snapkite-engine
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls snapkite-engine
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /var/www/snapkite-engine/npm-debug.log

Should I run a server for index.html? URL?

Sorry, I think I missed a step. Everything installed successfully. I have just installed React and React DOM and going though the updates to app.js. Was I supposed to start a sever in order to view index.html? I have the snapkite engine running on port 3011. I assume I need to run a node server also. What is the command to start the server?
I understand the code, but did not want to go too far if I am supposed to be running the examples.
This is the last code I added:
var section = React.createElement('section', { className: 'container'}, reactFragment);

-Thanks

Chapter 8 "Unexpected token" error with jsx pre-processing

When attempting to run the final 2 test suites from chapter 8 they fail with this error:

SyntaxError: /home/user/snapterest/source/components/__tests__/Header-test.js: 
Unexpected token (
var header = TestUtils.renderIntoDocument(
>    <Header text="Testing..." />
      ^

This error was resolved by adding a .babelrc file to the root of the project with the contents:

{
  "presets": ["es2015", "react"]
}

Is this fix required or did I make a mistake whilst working through the chapter?

error on npm start

snapkite-engine: (master)$ npm start

[email protected] start /Users/elizabethakari/practice_apps/first_react/snapkite-engine
node app.js

[Snapkite][Socket] Listening on port 3000
module.js:338
throw err;
^

Error: Cannot find module '../filters/snapkite-filter-is-possibly-sensitive'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at /Users/elizabethakari/practice_apps/first_react/snapkite-engine/controllers/twitter.js:67:20
at Array.forEach (native)
at isValidTweet (/Users/elizabethakari/practice_apps/first_react/snapkite-engine/controllers/twitter.js:65:30)
at null. (/Users/elizabethakari/practice_apps/first_react/snapkite-engine/controllers/twitter.js:93:9)
at emitOne (events.js:77:13)
at emit (events.js:169:7)

npm ERR! Darwin 13.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.1.1
npm ERR! npm v2.14.4
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node app.js'.
npm ERR! This is most likely a problem with the snapkite-engine package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get their info via:
npm ERR! npm owner ls snapkite-engine
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/elizabethakari/practice_apps/first_react/snapkite-engine/npm-debug.log

Snapkite Engine NPM Start fails on OSX - NPM Log messages below

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart [email protected]
6 info start [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec start script
9 verbose stack Error: [email protected] start: node app.js
9 verbose stack Exit status 1
9 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:818:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd /Users/Joe/snapkite-engine
12 error Darwin 14.5.0
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
14 error node v4.1.2
15 error npm v2.14.4
16 error code ELIFECYCLE
17 error [email protected] start: node app.js
17 error Exit status 1
18 error Failed at the [email protected] start script 'node app.js'.
18 error This is most likely a problem with the snapkite-engine package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node app.js
18 error You can get their info via:
18 error npm owner ls snapkite-engine
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

Questions

Questions

  1. Why did you choose browserify instead of webpack? Seems like every piece of React related documentation I see uses webpack. Have you considered writing a version using webpack?
  2. Will you publish something using react-router, or something similar, to show how single page apps can have user authentication etc.?

Chapter 8 Header Test

When I run the tests my Header-test fails with error:

SyntaxError: /Users/knoxjeffrey/React/twitterest/source/components/__tests__/Header-test.js: Unexpected token <

Any ideas on how to fix?

Error running gulp command

I'm already in Chapter 7 and still having this error when running gulp command.

➜  snapterest.dev  gulp
[19:35:39] Using gulpfile /var/www/snapterest.dev/gulpfile.js
[19:35:39] Starting 'default'...

events.js:72
        throw er; // Unhandled 'error' event
              ^
SyntaxError: /var/www/snapterest.dev/source/app.js: Unexpected token (5:16)
  3 | var Application = require('./components/Application.react');
  4 | 
> 5 | ReactDOM.render(<Application />, document.getElementById('react-application'));
    |                 ^
    at Parser.pp.raise (/var/www/snapterest.dev/node_modules/babylon/lib/parser/location.js:22:13)
    at Parser.pp.unexpected (/var/www/snapterest.dev/node_modules/babylon/lib/parser/util.js:91:8)
    at Parser.pp.parseExprAtom (/var/www/snapterest.dev/node_modules/babylon/lib/parser/expression.js:510:12)
    at Parser.pp.parseExprSubscripts (/var/www/snapterest.dev/node_modules/babylon/lib/parser/expression.js:265:19)
    at Parser.pp.parseMaybeUnary (/var/www/snapterest.dev/node_modules/babylon/lib/parser/expression.js:245:19)
    at Parser.pp.parseExprOps (/var/www/snapterest.dev/node_modules/babylon/lib/parser/expression.js:176:19)
    at Parser.pp.parseMaybeConditional (/var/www/snapterest.dev/node_modules/babylon/lib/parser/expression.js:158:19)
    at Parser.pp.parseMaybeAssign (/var/www/snapterest.dev/node_modules/babylon/lib/parser/expression.js:121:19)
    at Parser.pp.parseExprListItem (/var/www/snapterest.dev/node_modules/babylon/lib/parser/expression.js:988:16)
    at Parser.pp.parseCallExpressionArguments (/var/www/snapterest.dev/node_modules/babylon/lib/parser/expression.js:341:20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.