読者です 読者をやめる 読者になる 読者になる

Unexpected token while parsing file

"react": "^0.14.8",  

エラー

Error: /Users/   /index.js: Unexpected token (15:11) while parsing file: /Users/   /index.js

http://stackoverflow.com/questions/33460420/babel-loader-jsx-syntaxerror-unexpected-token

http://stackoverflow.com/questions/31302786/browserify-error-parsing-file-unexpected-token

https://github.com/babel/babelify

npm install --save babel-preset-es2015

で直った、気がする。

gulpfile.js

gulp.task('build', function() {
  browserify({entries: ['./index.js']})
    .transform("babelify", {presets: ["es2015", "react"]})
    .bundle()
    .on('error', errorHandler)
    .pipe(source('bundle.js'))
    .pipe(buffer())
    .pipe(gulp.dest('./build'))
    .pipe(browserSync.reload({stream: true}));
});

package.json

{
  "name": "react-login",
  "version": "1.0.0",
  "description": "for material UI",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "ku",
  "license": "MIT",
  "dependencies": {
    "babel-preset-es2015": "^6.6.0",
    "babel-preset-react": "^6.5.0",
    "babelify": "^7.2.0",
    "body-parser": "^1.15.0",
    "browser-sync": "^2.12.3",
    "browserify": "^13.0.0",
    "express": "^4.13.4",
    "gulp": "^3.9.1",
    "marked": "^0.3.5",
    "material-ui": "^0.14.4",
    "node-dev": "^3.1.0",
    "react": "^0.14.8",
    "react-dom": "^0.14.8",
    "react-router": "^2.2.4",
    "react-tap-event-plugin": "^0.2.2",
    "vinyl-buffer": "^1.0.0",
    "vinyl-source-stream": "^1.1.0"
  }
}

エラーその2

% gulp
[19:37:59] Using gulpfile ~/Documents/react-login/gulpfile.js
[19:37:59] Starting 'server'...
[19:37:59] 'server' errored after 24 ms
[19:37:59] TypeError: Cannot read property 'poll' of undefined
    at module.exports (/Users/kubotad/Documents/react-login/node_modules/node-dev/lib/index.js:31:49)
    at Gulp.<anonymous> (/Users/kubotad/Documents/react-login/gulpfile.js:38:3)
    at module.exports (/Users/kubotad/Documents/react-login/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/kubotad/Documents/react-login/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Users/kubotad/Documents/react-login/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/Users/kubotad/Documents/react-login/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
    at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20
    at process._tickCallback (node.js:355:11)
    at Function.Module.runMain (module.js:503:11)
    at startup (node.js:129:16)

gulpfile.js

gulp.task('server', function() {
  node('./server.js',[],[],[]);
});