Error in ReactJS setup in Ubuntu 16.04

Home / Uncategorized / Error in ReactJS setup in Ubuntu 16.04

Question:
I tried to follow https://www.tutorialspoint.com/reactjs/reactjs_environment_setup.htm inorder to setup reactJS in my device which has Ubuntu 16.04.

In the end i tried npm start but it results me following error
> reactjs@1.0.0 start /var/www/html/reactjs
> webpack-dev-server –hot

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
– configuration.output.path: The provided value "./" is not an absolute path!

npm ERR! Linux 4.10.0-28-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! reactjs@1.0.0 start: `webpack-dev-server –hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactjs@1.0.0 start script ‘webpack-dev-server –hot’.
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 reactjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:npm ERR! webpack-dev-server –hot
npm ERR! You can get information on how to open an issue for this project with:npm ERR! npm bugs reactjs
npm ERR! Or if that isn’t available, you can get their info via:npm ERR! npm owner ls reactjs
npm ERR! There is likely additional logging output above.

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

My package.json file
{
"name": "reactjs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server –hot"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^15.6.1",
"webpack": "^3.5.4",
"webpack-dev-server": "^2.7.1"
}
}


Answer:
The most straight forward error message ever.

You can’t use relative path in output (I don’t remember wheather it was possible in previous versions of webpack). Docs.
output: {
path: require(‘path’).resolve(__dirname, ‘./path/to/build/folder’),
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *