繁体   English   中英

NPM运行构建错误

[英]NPM run build error

当我运行npm run build ,出现错误。 我会得到一个dist文件夹。

ERROR in   Error: Child compilation failed:
  Entry module not found: Error: Can't resolve '/Users/jurdekker/Desktop/OnWeb/O  nWeb.react/Sisketeers/dist/index.html' in '/Users/jurdekker/Desktop/OnWeb/OnWe  b.react/Sisketeers':
  Error: Can't resolve '/Users/jurdekker/Desktop/OnWeb/OnWeb.react/Sisketeers/di  st/index.html' in '/Users/jurdekker/Desktop/OnWeb/OnWeb.react/Sisketeers'

  - compiler.js:76
    [Sisketeers]/[html-webpack-plugin]/lib/compiler.js:76:16

  - Compiler.js:304 compile
    [Sisketeers]/[webpack]/lib/Compiler.js:304:11

  - Compiler.js:514 applyPluginsAsync.err
    [Sisketeers]/[webpack]/lib/Compiler.js:514:14

  - Tapable.js:202 next
    [Sisketeers]/[tapable]/lib/Tapable.js:202:11

  - CachePlugin.js:78 Compiler.<anonymous>
    [Sisketeers]/[webpack]/lib/CachePlugin.js:78:5

  - Tapable.js:206 Compiler.applyPluginsAsyncSeries
    [Sisketeers]/[tapable]/lib/Tapable.js:206:13

  - Compiler.js:511 compilation.seal.err
    [Sisketeers]/[webpack]/lib/Compiler.js:511:11

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [Sisketeers]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:671 self.applyPluginsAsync.err
    [Sisketeers]/[webpack]/lib/Compilation.js:671:19

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [Sisketeers]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:662 self.applyPluginsAsync.err
    [Sisketeers]/[webpack]/lib/Compilation.js:662:11

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [Sisketeers]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:657 self.applyPluginsAsync.err
    [Sisketeers]/[webpack]/lib/Compilation.js:657:10

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [Sisketeers]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:653 sealPart2
    [Sisketeers]/[webpack]/lib/Compilation.js:653:9

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [Sisketeers]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:596 Compilation.seal
    [Sisketeers]/[webpack]/lib/Compilation.js:596:8

  - Compiler.js:508 applyPluginsParallel.err
    [Sisketeers]/[webpack]/lib/Compiler.js:508:17

  - Tapable.js:289
    [Sisketeers]/[tapable]/lib/Tapable.js:289:11

  - Compilation.js:498 _addModuleChain
    [Sisketeers]/[webpack]/lib/Compilation.js:498:11

  - Compilation.js:381 errorAndCallback.bail
    [Sisketeers]/[webpack]/lib/Compilation.js:381:4

  - Compilation.js:404 moduleFactory.create
    [Sisketeers]/[webpack]/lib/Compilation.js:404:13

  - NormalModuleFactory.js:235 factory
    [Sisketeers]/[webpack]/lib/NormalModuleFactory.js:235:20

  - NormalModuleFactory.js:60 resolver
    [Sisketeers]/[webpack]/lib/NormalModuleFactory.js:60:20

  - NormalModuleFactory.js:127 asyncLib.parallel
    [Sisketeers]/[webpack]/lib/NormalModuleFactory.js:127:20

  - async.js:3874
    [Sisketeers]/[async]/dist/async.js:3874:9

  - async.js:473
    [Sisketeers]/[async]/dist/async.js:473:16

  - async.js:1048 iteratorCallback
    [Sisketeers]/[async]/dist/async.js:1048:13

  - async.js:958
    [Sisketeers]/[async]/dist/async.js:958:16

  - async.js:3871
    [Sisketeers]/[async]/dist/async.js:3871:13


Child html-webpack-plugin for "index.html":

    ERROR in Entry module not found: Error: Can't resolve '/Users/jurdekker/Desktop/OnWeb/OnWeb.react/Sisketeers/dist/index.html' in '/Users/jurdekker/Desktop/OnWeb/OnWeb.react/Sisketeers'
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js!node_modules/sass-loader/lib/loader.js!sass/main.scss:
       [0] ./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js!./sass/main.scss 1.27 kB {0} [built]
        + 1 hidden module
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! onweb-sisketeers@1.0.0 build: `webpack`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the onweb-sisketeers@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jurdekker/.npm/_logs/2018-01-19T17_33_37_060Z-debug.log
Jurs-MacBook-Pro:Sisketeers jurdekker$

我一直都收到此错误,但我不知道这是否取决于webpack或其他原因。 在我的dist文件夹中,我得到了一个带有相同错误的.html文件。 我本人不了解npm,所以如果有人可以提供更多有关npm的信息,我想听听。


更新22-01-2018

这是我的webpack配置,我看不到任何错误。 也许您找到了什么?

 const path = require('path'); const ExtractTextPlugin = require("extract-text-webpack-plugin"); const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry : './src/index.js', output : { filename : 'bundle.js', path : path.resolve(__dirname, 'dist') }, devtool : 'inline-source-map', devServer : { // contentBase : './dist' historyApiFallback: true }, module : { rules : [ { test : /\\.(js|jsx)$/, exclude : /(node_modules|bower_components)/, use : { loader : 'babel-loader', options : { presets : [ 'env', 'react', 'stage-2' ] } } }, { test : /\\.scss$/, use : ExtractTextPlugin.extract({ use : [ { loader : "css-loader" }, { loader : "sass-loader" } ], // use style-loader in // development fallback : "style-loader" }) } ] }, plugins : [ new ExtractTextPlugin("styles.css"), new HtmlWebpackPlugin({ template : path.join(path.resolve(__dirname, 'dist'), 'index.html') }) ], resolve : { extensions : [ '.js', '.jsx' ] } }; 

Webpack找不到某些模块。 需要检查您的webpack配置

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM