2017-07-03 1 views
2

Ich habe einen Fehler: Ungültiges Konfigurationsobjekt. Webpack wurde mit einem Konfigurationsobjekt initialisiert, das nicht mit dem API-Schema übereinstimmt. - configuration.output.path: Der angegebene Wert "./" ist kein absoluter Pfad!configuration.output.path: Der angegebene Wert "./" ist kein absoluter Pfad

während reactjs Mein package.json unter

feilen Sie die Installation
{ 
    "name": "reactset", 
    "version": "1.0.0", 
    "description": "react", 
    "main": "index.js", 
    "scripts": { 
    "start": "webpack-dev-server --hot" 
    }, 
    "keywords": [ 
    "test" 
    ], 
    "author": "test", 
    "license": "ISC", 
    "dependencies": { 
    "babel-core": "^6.25.0", 
    "babel-loader": "^7.1.1", 
    "babel-preset-es2015": "^6.24.1", 
    "babel-preset-react": "^6.24.1", 
    "react": "^15.6.1", 
    "react-dom": "^15.6.1", 
    "webpack": "^3.0.0", 
    "webpack-dev-server": "^2.5.0" 
    } 
} 
using upgraded node version 4.0 and npm 5.0 
Error : 
npm ERR! code ELIFECYCLE 
npm ERR! errno 1 
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. 
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 

helfen Bitte zur Lösung Lösung: URL, die für die Installation helfen:

https://www.tutorialspoint.com/reactjs/reactjs_environment_setup.htm

+1

Sie den Fehler gelesen haben? Es sagt Ihnen genau, was ist falsch mit ihm .... ersetzen configuration.output.path Wert mit einem vollständigen Pfad zum Ausgabeordner, oder verwenden Sie die 'path.join (__ Verzeichnisname, 'dist')' –

+1

Mögliche Duplikat von [Ungültige Konfiguration Objekt output.path ist kein absoluter Pfad] (https://stackoverflow.com/questions/43028487/invalid-configuration-object-output-path-is-not-an-absolute-path) –

Antwort

8

Bitte ändern

output: { 
     path:'./', 
     filename: 'index.js', 
    } 

Nach

output: { 
     path:+__dirname+'/', 
     filename: 'index.js', 
    } 

Oder mit anderen Worten ändern path: __dirname + '/'