2017-11-22 18 views
0

npm 및 webpack 및 최신 JavaScript 사용법을 배우려는 목적으로 매체에서 story을 읽었습니다. 모든 것은 webpack을 설치할 때까지 훌륭했습니다. 나는Webpack run 빌드 및 시계 오류

{ 
 
    "name": "ebdae", 
 
    "version": "1.0.0", 
 
    "description": "nodescription", 
 
    "main": "index.js", 
 
    "scripts": { 
 
    "test": "echo \"Error: no test specified\" && exit 1", 
 
    "build": "webpack --progress -p", 
 
    "watch": "webpack --progress --watch" 
 
    }, 
 
    "repository": { 
 
    "type": "git", 
 
    "url": "ebdae" 
 
    }, 
 
    "author": "elhakim", 
 
    "license": "ISC", 
 
    "devDependencies": { 
 
    "babel-core": "^6.26.0", 
 
    "babel-loader": "^7.1.2", 
 
    "babel-preset-env": "^1.6.1", 
 
    "webpack": "^3.8.1" 
 
    }, 
 
    "dependencies": {} 
 
}

package.json 파일 여기에이 명령 npm run buildnpm run watch 그 스크립트를 존재 실행하려고하지만이 명령 줄 No configuration file found and no output filename configured via CLI option. A configuration file could be named 'webpack.config.js' in the current directory.

에이 오류를 표시하지만, 설정 파일에 존재 .bin 폴더는 일반적으로 다음 코드를 포함합니다.

하고 다음과 같이 트리 구조 :

| .git 
| assets 
    | js 
     | index.js 
     | bundle.js 
| node_modules 
    | .bin 
     | ... 
     | webpack.config.js 
| package-lock.json 
| package.json 
+0

안녕과 같이해야한다. 이것은 "빌드"와 같아야합니다 : "webpack --progress -p --config /node_modules/.bin/webpack.config.js"' –

+0

** 감사합니다 ** @ pravesh-khatri, 그리고 항목을 변경하고 출력 경로가 제대로 작동하도록하기 위해서 나는'../../ '을'. /'로 대체했다. 너무,'--display-error-details'는 제 베이컨을 저장했습니다. ** 대단히 감사합니다 **. – Elhakim

답변

2

당신은 스크립트의 모든 웹팩 구성 파일을 제공하지 않았습니다.

그것은 당신은 당신의 스크립트에있는`웹팩 configuration` 파일을 제공하지 않은,이

"build": "webpack --progress -p --config /node_modules/.bin/webpack.config.js"