2017-07-12 24 views
0

こんにちは私はwebpackについての超初心者ですが、私は問題を解決するために4時間の調査をしましたので、ここで問題を投稿することにしました。 これは私が "webpack"コマンドを起動したときの私のプロンプト表示です。Webpack設定の問題

WARNING in ./~/ajv/lib/async.js 96:20 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/async.js 119:15 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/compile/index.js 13:21 Critical dependency: the request of a dependency is an expression

ERROR in .//pdf3json/pdfparser.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\pdf3json' @ .//pdf3json/pdfparser.js 5:9-22 @ ./~/pdf2text/index.js @ ./main.js

ERROR in .//download-file/index.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\download-file' @ .//download-file/index.js 1:9-22 @ ./~/download-pdf/index.js @ ./main.js

ERROR in .//request/lib/har.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\request\lib' @ .//request/lib/har.js 3:9-22 @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//pdf3json/lib/pdf.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\pdf3json\lib' @ .//pdf3json/lib/pdf.js 3:9-22 @ .//pdf3json/pdfparser.js @ .//pdf2text/index.js @ ./main.js

ERROR in .//forever-agent/index.js Module not found: Error: Can't resolve 'net' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\forever-agent' @ .//forever-agent/index.js 6:10-24 @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//forever-agent/index.js Module not found: Error: Can't resolve 'tls' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\forever-agent' @ .//forever-agent/index.js 7:10-24 @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//pdf3json/package.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\pdf3json\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ .//pdf3json/lib/pdf.js 11:13-39 @ .//pdf3json/pdfparser.js @ .//pdf2text/index.js @ ./main.js

ERROR in .//tough-cookie/lib/cookie.js Module not found: Error: Can't resolve 'net' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\tough-cookie\lib' @ .//tough-cookie/lib/cookie.js 32:10-24 @ .//request/lib/cookies.js @ .//request/index.js @ ./main.js

ERROR in .//tough-cookie/package.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\tough-cookie\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ .//tough-cookie/lib/cookie.js 38:14-40 @ .//request/lib/cookies.js @ .//request/index.js @ ./main.js

ERROR in .//mkdirp/index.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\mkdirp' @ .//mkdirp/index.js 2:9-22 @ .//download-file/index.js @ .//download-pdf/index.js @ ./main.js

ERROR in .//pdf3json/lib/ptixmlinject.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\pdf3json\lib' @ .//pdf3json/lib/ptixmlinject.js 5:5-18 @ .//pdf3json/lib/pdf.js @ .//pdf3json/pdfparser.js @ ./~/pdf2text/index.js @ ./main.js

ERROR in .//tunnel-agent/index.js Module not found: Error: Can't resolve 'net' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\tunnel-agent' @ .//tunnel-agent/index.js 3:10-24 @ .//request/lib/tunnel.js @ .//request/request.js @ ./~/request/index.js @ ./main.js

ERROR in .//tunnel-agent/index.js Module not found: Error: Can't resolve 'tls' in 'C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\tunnel-agent' @ .//tunnel-agent/index.js 4:10-24 @ .//request/lib/tunnel.js @ .//request/request.js @ ./~/request/index.js @ ./main.js

ERROR in (webpack)//browserify-sign/browser/algorithms.json Module parse failed: C:\Users\stagista11\AppData\Roaming\npm\node_modules\webpack\node_modules\browserify-sign\browser\algorithms.json Unexpected token (2:27) You may need an appropriate loader to handle this file type. | { | "sha224WithRSAEncryption": { | "sign": "rsa", | "hash": "sha224", @ (webpack)//browserify-sign/algos.js 1:17-53 @ (webpack)//crypto-browserify/index.js @ .//request/lib/helpers.js @ ./~/request/index.js @ ./main.js

ERROR in .//mime-db/db.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\mime-db\db.json Unexpected token (2:40) You may need an appropriate loader to handle this file type. | { | "application/1d-interleaved-parityfec": { | "source": "iana" | }, @ .//mime-db/index.js 11:17-37 @ .//mime-types/index.js @ .//request/request.js @ ./~/request/index.js @ ./main.js

ERROR in (webpack)//diffie-hellman/lib/primes.json Module parse failed: C:\Users\stagista11\AppData\Roaming\npm\node_modules\webpack\node_modules\diffie-hellman\lib\primes.json Unexpected token (2:11) You may need an appropriate loader to handle this file type. | { | "modp1": { | "gen": "02", | "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff" @ (webpack)//diffie-hellman/browser.js 2:13-41 @ (webpack)//crypto-browserify/index.js @ .//request/lib/helpers.js @ ./~/request/index.js @ ./main.js

ERROR in (webpack)//browserify-sign/browser/curves.json Module parse failed: C:\Users\stagista11\AppData\Roaming\npm\node_modules\webpack\node_modules\browserify-sign\browser\curves.json Unexpected token (2:16) You may need an appropriate loader to handle this file type. | { | "1.3.132.0.10": "secp256k1", | "1.3.132.0.33": "p224", | "1.2.840.10045.3.1.1": "p192", @ (webpack)//browserify-sign/browser/sign.js 7:13-37 @ (webpack)//browserify-sign/browser/index.js @ (webpack)//crypto-browserify/index.js @ .//request/lib/helpers.js @ .//request/index.js @ ./main.js

ERROR in (webpack)//elliptic/package.json Module parse failed: C:\Users\stagista11\AppData\Roaming\npm\node_modules\webpack\node_modules\elliptic\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ (webpack)//elliptic/lib/elliptic.js 5:19-45 @ (webpack)//create-ecdh/browser.js @ (webpack)//crypto-browserify/index.js @ .//request/lib/helpers.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/afterRequest.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\afterRequest.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "afterRequest.json#", | "type": "object", | "optional": true, @ .//har-schema/lib/index.js 4:16-46 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/beforeRequest.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\beforeRequest.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "beforeRequest.json#", | "type": "object", | "optional": true, @ .//har-schema/lib/index.js 5:17-48 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/browser.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\browser.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "browser.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 6:11-36 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/cache.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\cache.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "cache.json#", | "properties": { | "beforeRequest": { @ .//har-schema/lib/index.js 7:9-32 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/cookie.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\cookie.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "cookie.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 9:10-34 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/creator.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\creator.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "creator.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 10:11-36 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/content.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\content.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "content.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 8:11-36 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/entry.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\entry.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "entry.json#", | "type": "object", | "optional": true, @ .//har-schema/lib/index.js 11:9-32 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/har.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\har.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "har.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 12:7-28 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/header.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\header.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "header.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 13:10-34 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/log.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\log.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "log.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 14:7-28 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/page.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\page.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "page.json#", | "type": "object", | "optional": true, @ .//har-schema/lib/index.js 15:8-30 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/pageTimings.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\pageTimings.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "pageTimings.json#", | "type": "object", | "properties": { @ .//har-schema/lib/index.js 16:15-44 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/postData.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\postData.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "postData.json#", | "type": "object", | "optional": true, @ .//har-schema/lib/index.js 17:12-38 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/query.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\query.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "query.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 18:9-32 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/request.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\request.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "request.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 19:11-36 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/response.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\response.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "response.json#", | "type": "object", | "required": [ @ .//har-schema/lib/index.js 20:12-38 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//har-schema/lib/timings.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\timings.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "timings.json#", | "required": [ | "send", @ .//har-schema/lib/index.js 21:11-36 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//ajv/lib/refs/json-schema-draft-04.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\ajv\lib\refs\json-schema-draft-04.json Unexpected token (2:8) You may need an appropriate loader to handle this file type. | { | "id": "htp://json-schema.org/draft-04/schema#", | "$schema": "htp://json-schema.org/draft-04/schema#", | "description": "Core schema meta-schema", @ .//ajv/lib/ajv.js 385:23-66 @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ .//request/index.js @ ./main.js

ERROR in .//ajv/lib/refs/json-schema-v5.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\ajv\lib\refs\json-schema-v5.json Unexpected token (2:8) You may need an appropriate loader to handle this file type. | { | "id": "htps://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/json-schema-v5.json#", | "$schema": "htp://json-schema.org/draft-04/schema#", | "description": "Core schema meta-schema (v5 proposals)", @ .//ajv/lib/v5.js 20:21-58 @ .//ajv/lib/ajv.js @ .//har-validator/lib/node4/promise.js @ .//request/lib/har.js @ .//request/request.js @ ./~/request/index.js @ ./main.js

ERROR in (webpack)//parse-asn1/aesid.json Module parse failed: C:\Users\stagista11\AppData\Roaming\npm\node_modules\webpack\node_modules\parse-asn1\aesid.json Unexpected token (1:25) You may need an appropriate loader to handle this file type. | {"2.16.840.1.101.3.4.1.1": "aes-128-ecb", | "2.16.840.1.101.3.4.1.2": "aes-128-cbc", | "2.16.840.1.101.3.4.1.3": "aes-128-ofb", @ (webpack)//parse-asn1/index.js 2:12-35 @ (webpack)//public-encrypt/privateDecrypt.js @ (webpack)//public-encrypt/browser.js @ (webpack)//crypto-browserify/index.js @ .//request/lib/helpers.js @ ./~/request/index.js @ ./main.js

これは私の "webpack.config.js"です。

module.exports = { entry: './main.js', output: { filename: './bundle.js' } }; 

私は読むために多くのことを知っている:。。。(しかし、私は本当にすべてのものに感謝

私はこれに設定ファイルを変更し

module.exports = { entry: './main.js', output: { filename: './bundle.js' }, target: 'node' }; 

プロンプトの表示この

WARNING in ./~/ajv/lib/async.js 96:20 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/async.js 119:15 Critical dependency: the request of a dependency is an expression

WARNING in ./~/ajv/lib/compile/index.js 13:21 Critical dependency: the request of a dependency is an expression

ERROR in ./~/pdf3json/package.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\pdf3json\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ ./~/pdf3json/lib/pdf.js 11:13-39 @ ./~/pdf3json/pdfparser.js @ ./~/pdf2text/index.js @ ./main.js

ERROR in ./~/tough-cookie/package.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\tough-cookie\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ ./~/tough-cookie/lib/cookie.js 38:14-40 @ ./~/request/lib/cookies.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/hawk/package.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\hawk\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. | { | "_args": [ | [ | { @ ./~/hawk/lib/utils.js 14:11-37 @ ./~/hawk/lib/index.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/mime-db/db.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\mime-db\db.json Unexpected token (2:40) You may need an appropriate loader to handle this file type. | { | "application/1d-interleaved-parityfec": { |
"source": "iana" | }, @ ./~/mime-db/index.js 11:17-37 @ ./~/mime-types/index.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/afterRequest.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\afterRequest.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "afterRequest.json#", | "type": "object", | "optional": true, @ ./~/har-schema/lib/index.js 4:16-46 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/beforeRequest.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\beforeRequest.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "beforeRequest.json#", | "type": "object", | "optional": true, @ ./~/har-schema/lib/index.js 5:17-48 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/browser.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\browser.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "browser.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 6:11-36 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/cache.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\cache.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "cache.json#", | "properties": { |
"beforeRequest": { @ ./~/har-schema/lib/index.js 7:9-32 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/content.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\content.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "content.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 8:11-36 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/cookie.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\cookie.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "cookie.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 9:10-34 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/creator.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\creator.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "creator.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 10:11-36 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/entry.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\entry.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "entry.json#", | "type": "object", |
"optional": true, @ ./~/har-schema/lib/index.js 11:9-32 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/har.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\har.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "har.json#", | "type": "object", |
"required": [ @ ./~/har-schema/lib/index.js 12:7-28 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/header.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\header.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "header.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 13:10-34 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/log.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\log.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "log.json#", | "type": "object", |
"required": [ @ ./~/har-schema/lib/index.js 14:7-28 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/page.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\page.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "page.json#", | "type": "object", |
"optional": true, @ ./~/har-schema/lib/index.js 15:8-30 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/pageTimings.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\pageTimings.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "pageTimings.json#", | "type": "object", | "properties": { @ ./~/har-schema/lib/index.js 16:15-44 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/postData.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\postData.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "postData.json#", | "type": "object", | "optional": true, @ ./~/har-schema/lib/index.js 17:12-38 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/request.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\request.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "request.json#", | "type": "object", | "required": [ @ ./~/har-schema/lib/index.js 19:11-36 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

ERROR in ./~/har-schema/lib/query.json Module parse failed: C:\Users\stagista11\Desktop\Progetto\video-stats\node_modules\har-schema\lib\query.json Unexpected token (2:6) You may need an appropriate loader to handle this file type. | { | "id": "query.json#", | "type": "object", |
"required": [ @ ./~/har-schema/lib/index.js 18:9-32 @ ./~/har-validator/lib/node4/promise.js @ ./~/request/lib/har.js @ ./~/request/request.js @ ./~/request/index.js @ ./main.js

+0

webpackの設定に 'target: 'node''を追加できますか? 'module.exports = {entry: './main.js'、output:{filename: './bundle.js'}、target: 'node'};' – Svenskunganka

+0

これはどういうわけかいくつかのエラーを表示します –

答えて

1

webpack-node-externalsモジュールを使用してノードパックをロードするWebpackを停止してを取り除く

次に、モジュール解析の失敗の原因となるjson-loaderをインストールします。これが動作しない場合

var nodeExternals = require('webpack-node-externals'); 

module.exports = { 
    entry: './main.js', 
    output: { filename: './bundle.js' }, 
    target: 'node', 
    externals: [nodeExternals()], 
    resolve: { 
    extensions: ['', '.js', '.json'] 
    } 
    rules: [ 
    { 
     test: /\.json$/, 
     use: 'json-loader' 
    } 
    ] 
}; 

あなたのpackage.jsonとdir構造を投稿してください。

+0

ナンセンスな質問のためにすみません。node.jsスクリプト(「私のよう」)をクライアントサイドスクリプトに変換することは可能ですか? –

+0

私はあなたのスクリプトを見たことがありませんが、どこにでもJavaScriptファイルを実行するモジュールはUMDと呼ばれています:https://github.com/umdjs/umd。あなたのブラウザとnode.jsには異なるランタイムがありますが、ブラウザーには 'fs'、 'http'、 'path'などのライブラリはなく、node.jsにはglobal.btoaとglobal.atobがありません十分に簡単です。 – sidhuko

+0

あなたは優秀な人間です。だから私はすべてのノードスクリプトをクライアント側のスクリプトに変換することができます。例えば、browserifyですが...私はfs httpとパスのようなモジュールを使うことはできません。 –