2017-08-15 55 views
0

我試圖按照https://www.tutorialspoint.com/reactjs/reactjs_environment_setup.htm的順序在我的設備中安裝reactJS,它有Ubuntu 16.04。Ubuntu中的ReactJS安裝中的錯誤16.04

在最後,我試圖npm start,但它導致了我下面的錯誤

> [email protected] 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! [email protected] start: `webpack-dev-server --hot` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] 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 

的package.json文件

{ 
    "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" 
    } 
} 

回答

1

最直接的錯誤永遠消息。

你不能在輸出中使用相對路徑(我不記得以前版本的webpack中可能有這種路徑)。 Docs

output: { 
    path: require('path').resolve(__dirname, './path/to/build/folder'), 
+0

準確地放置該代碼的位置? – Ninja

+0

@RafinKarki Webpack配置文件。 –