FountainJS / generator-fountain-webapp

Yeoman 'fountain' generator to start a webapp
http://fountainjs.io
MIT License
967 stars 67 forks source link

gulp build fails #179

Closed mariusstaicu closed 7 years ago

mariusstaicu commented 7 years ago

Description

After installing latest version of generator using yo and running gulp, build fails (see below).

Error Message & Stack Trace

[23:21:10] Loading /home/marius/Downloads/test-angular2/gulp_tasks/browsersync.js
[23:21:10] Loading /home/marius/Downloads/test-angular2/gulp_tasks/karma.js
[23:21:10] Loading /home/marius/Downloads/test-angular2/gulp_tasks/misc.js
[23:21:10] Loading /home/marius/Downloads/test-angular2/gulp_tasks/webpack.js
keywords if/then/else require v5 option
[23:21:11] Using gulpfile ~/Downloads/test-angular2/gulpfile.js
[23:21:11] Starting 'default'...
[23:21:11] Starting 'clean'...
[23:21:11] Finished 'clean' after 9.05 ms
[23:21:11] Starting 'build'...
[23:21:11] Starting 'other'...
[23:21:11] Starting 'webpack:dist'...
[23:21:11] Finished 'other' after 141 ms
ts-loader: Using typescript@2.1.5 and /home/marius/Downloads/test-angular2/tsconfig.json
[23:21:35] Time: 24137ms
                         Asset     Size  Chunks       Chunk Names
  main-c901d73993e102db76b5.js  1.18 MB    0, 1       main
vendor-c901d73993e102db76b5.js  1.34 kB       1       vendor

ERROR in ./~/todomvc-app-css/index.css
Module build failed: ModuleBuildError: Module build failed: Error: Cannot find module '/home/marius/Downloads/test-angular2/node_modules/css-loader/index.js?minimize'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at loadLoader (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/loadLoader.js:13:17)
    at iteratePitchingLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:131:2)
    at NormalModule.build (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:179:15)
    at Compilation.buildModule (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:127:9)
    at Compilation.<anonymous> (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:404:8)
    at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:74:13
    at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/marius/Downloads/test-angular2/node_modules/tapable/lib/Tapable.js:196:70)
    at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:49:11)
    at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:165:6)
    at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:161:6
    at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:143:35
    at /home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:364:11
    at /home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:170:18
    at loadLoader (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/loadLoader.js:27:11)
    at iteratePitchingLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:131:2)
    at NormalModule.build (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:179:15)
    at Compilation.buildModule (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:127:9)
    at Compilation.<anonymous> (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:404:8)
    at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:74:13
    at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/marius/Downloads/test-angular2/node_modules/tapable/lib/Tapable.js:196:70)
    at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:49:11)
    at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:165:6)
    at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:161:6
    at /home/marius/Downloads/test-angular2/node_modules/webpack/node_modules/async/dist/async.js:3694:9

ERROR in /home/marius/Downloads/test-angular2/node_modules/extract-text-webpack-plugin/loader.js?{"omit":1,"remove":true}!/home/marius/Downloads/test-angular2/node_modules/style-loader/index.js!/home/marius/Downloads/test-angular2/node_modules/css-loader/index.js?minimize!/home/marius/Downloads/test-angular2/node_modules/sass-loader/index.js!/home/marius/Downloads/test-angular2/node_modules/postcss-loader/index.js!/home/marius/Downloads/test-angular2/node_modules/todomvc-app-css/index.css doesn't export content

ERROR in ./src/index.scss
Module build failed: ModuleBuildError: Module build failed: Error: Cannot find module '/home/marius/Downloads/test-angular2/node_modules/css-loader/index.js?minimize'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at loadLoader (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/loadLoader.js:13:17)
    at iteratePitchingLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:131:2)
    at NormalModule.build (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:179:15)
    at Compilation.buildModule (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:127:9)
    at Compilation.<anonymous> (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:404:8)
    at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:74:13
    at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/marius/Downloads/test-angular2/node_modules/tapable/lib/Tapable.js:196:70)
    at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:49:11)
    at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:165:6)
    at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:161:6
    at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:143:35
    at /home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:364:11
    at /home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:170:18
    at loadLoader (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/loadLoader.js:27:11)
    at iteratePitchingLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:131:2)
    at NormalModule.build (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:179:15)
    at Compilation.buildModule (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:127:9)
    at Compilation.<anonymous> (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:404:8)
    at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:74:13
    at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/marius/Downloads/test-angular2/node_modules/tapable/lib/Tapable.js:196:70)
    at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:49:11)
    at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:165:6)
    at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:161:6
    at /home/marius/Downloads/test-angular2/node_modules/webpack/node_modules/async/dist/async.js:3694:9

ERROR in /home/marius/Downloads/test-angular2/node_modules/extract-text-webpack-plugin/loader.js?{"omit":1,"remove":true}!/home/marius/Downloads/test-angular2/node_modules/style-loader/index.js!/home/marius/Downloads/test-angular2/node_modules/css-loader/index.js?minimize!/home/marius/Downloads/test-angular2/node_modules/sass-loader/index.js!/home/marius/Downloads/test-angular2/node_modules/postcss-loader/index.js!/home/marius/Downloads/test-angular2/src/index.scss doesn't export content
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  2.96 kB       0       
Child extract-text-webpack-plugin:

    ERROR in ./~/css-loader?minimize!./~/sass-loader!./~/postcss-loader!./~/todomvc-app-css/index.css
    Module build failed: Error: Cannot find module '/home/marius/Downloads/test-angular2/node_modules/css-loader/index.js?minimize'
        at Function.Module._resolveFilename (module.js:469:15)
        at Function.Module._load (module.js:417:25)
        at Module.require (module.js:497:17)
        at require (internal/module.js:20:19)
        at loadLoader (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/loadLoader.js:13:17)
        at iteratePitchingLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
        at runLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
        at NormalModule.doBuild (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:131:2)
        at NormalModule.build (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:179:15)
        at Compilation.buildModule (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:127:9)
        at Compilation.<anonymous> (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:404:8)
        at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:74:13
        at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/marius/Downloads/test-angular2/node_modules/tapable/lib/Tapable.js:196:70)
        at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:49:11)
        at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:165:6)
        at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:161:6
Child extract-text-webpack-plugin:

    ERROR in ./~/css-loader?minimize!./~/sass-loader!./~/postcss-loader!./src/index.scss
    Module build failed: Error: Cannot find module '/home/marius/Downloads/test-angular2/node_modules/css-loader/index.js?minimize'
        at Function.Module._resolveFilename (module.js:469:15)
        at Function.Module._load (module.js:417:25)
        at Module.require (module.js:497:17)
        at require (internal/module.js:20:19)
        at loadLoader (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/loadLoader.js:13:17)
        at iteratePitchingLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
        at runLoaders (/home/marius/Downloads/test-angular2/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
        at NormalModule.doBuild (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:131:2)
        at NormalModule.build (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModule.js:179:15)
        at Compilation.buildModule (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:127:9)
        at Compilation.<anonymous> (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/Compilation.js:404:8)
        at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:74:13
        at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/marius/Downloads/test-angular2/node_modules/tapable/lib/Tapable.js:196:70)
        at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:49:11)
        at onDoneResolving (/home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:165:6)
        at /home/marius/Downloads/test-angular2/node_modules/webpack/lib/NormalModuleFactory.js:161:6
[23:21:35] Finished 'webpack:dist' after 24 s
[23:21:35] Finished 'build' after 24 s
[23:21:35] Finished 'default' after 24 s

Config

Copy the content from .yo-rc.json:

{
  "generator-fountain-angular2": {
    "version": "1.0.0-rc2",
    "props": {
      "framework": "angular2",
      "modules": "webpack",
      "js": "typescript",
      "ci": [],
      "css": "scss",
      "resolved": "/home/marius/.npm-packages/lib/node_modules/generator-fountain-webapp/node_modules/generator-fountain-angular2/generators/app/index.js",
      "namespace": "fountain-angular2",
      "argv": {
        "remain": [],
        "cooked": [],
        "original": []
      },
      "sample": "todoMVC",
      "router": "router"
    }
  }
}

Environment

Tell us which operating system you are using, as well as which versions of Node.js, npm, and yo. Run the following to get it quickly:

node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
Node.js v6.9.4
linux 4.4.0-59-generic

yo --version
1.8.5

npm --version
4.1.1
fachat commented 7 years ago

I have the same problem. Differences are:

fachat commented 7 years ago

What I noted is that during the yo generate, I get unresolved dependencies: UNMET PEER DEPENDENCY zone.js@0.6.26 UNMET PEER DEPENDENCY webpack@2.1.0-beta.27 UNMET PEER DEPENDENCY rxjs@5.0.0-beta.12 UNMET PEER DEPENDENCY babel-core@^6.0.0

mariusstaicu commented 7 years ago

upgraded to webpack 2.2.1 in package.json and it works ok

mikeymco commented 7 years ago

@mariusstaicu thanks for the tip! Upgrading to Webpack 2.2.1 allows my builds to succeed.

The UNMET PEER DEPENDENCY issue still persists and, while I'm assuming this is caused by a dependency being updated, I'm unable to decipher which one is responsible.

mariusstaicu commented 7 years ago

there seem to be some issues with resolving dependencies, however webpack is downloaded in node_modules and gulp build works after that.

I am ok with this workaround as long as it allows me to move on with this issue.

mikeymco commented 7 years ago

@mariusstaicu it appears this change has broken Karma's ability to find/load Webpack. Is this also the case for you?

mariusstaicu commented 7 years ago

yes, indeed, it's the same, noticed just now

TKasekamp commented 7 years ago

I had the same problem with the CSS files and it seems that it's related to this issue in webpack.

I didn't update the webpack version. Instead I edited a few lines in webpack.dist.conf.js: I replaced this

        test: /\.css$/,
         loaders: ExtractTextPlugin.extract({
           fallbackLoader: 'style-loader',
           loader: 'css-loader?minimize!postcss-loader'
         })

with this

        test: /\.css$/,
         loaders: ExtractTextPlugin.extract({
           fallbackLoader: 'style-loader',
           loader: 'css-loader'
         })

Now both build and test work.

mikeymco commented 7 years ago

@TKasekamp thanks for the additional info. Based on that, I was able to get things running properly (without changing webpack.dist.conf.js) by updating the following dependencies to these versions:

"css-loader": "^0.26.1",
"karma-webpack": "^2.0.2",
"webpack": "2.2.1",

If you try these module versions could you please confirm whether they work or not on your system?

If anyone can point me in the right direction to fix these version inclusions I'd be happy to make a PR.

TKasekamp commented 7 years ago

@mikeymco I reverted the webpack.dist.conf.js to it's original versions and updated the dependencies to the ones you provided. I still get the build error, so this isn't a fix for me.

My system

win32 10.0.10586
node v6.7.0
npm  v3.10.3
yo 1.8.5
JPFeli commented 7 years ago

I resolved this using the last version for any webpack package in the package.json Just remove the ^ in the webpack dependency version and try.

cuspymd commented 7 years ago

The fix below also solves this issue. It does the same thing as the original code.

      {
        test: /\.css$/,
        loaders: ExtractTextPlugin.extract({
          fallbackLoader: 'style-loader',
            loader: [{
                loader: 'css-loader',
                options: {
                    minimize: true
                }
            }, {
                loader: 'postcss-loader'
            }]
        })
      },
mariusstaicu commented 7 years ago

Thanks for the suggestions. they all seem to work. I preferred to go with updating package.json versions for css-loader, karma-webpack and html-webpack-plugin to latest.

sanathbits commented 7 years ago

I updated all the npm packages using npm-check-updates and it worked like a charm right after. I used the commands - npm-check-updates to check all the packages that need updating. then I ran npm-check-updates -u to update all the versions in your package.json (this is the magic sauce) npm update as usual to install the new versions of your packages based on the updated package.json.

Mithgroth commented 7 years ago

After upgrading to Webpack 2.2.1 and doing what @sanathbits suggested, I'm getting:

WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration has an unknown property 'debug'. The 'debug' property was removed in webpack 2.

Couldn't locate the source of the problem yet.

ProfitWarning commented 7 years ago

Migrating from v1 to v2 https://webpack.js.org/guides/migrating/ my develop config:

const webpack = require('webpack'); const conf = require('./gulp.conf'); const path = require('path');

const HtmlWebpackPlugin = require('html-webpack-plugin'); const FailPlugin = require('webpack-fail-plugin'); const autoprefixer = require('autoprefixer');

module.exports = { module: { rules: [ { test: /.js$/, exclude: /node_modules/, loader: 'eslint-loader', enforce: 'pre' }, { test: /.css$/, use: [ 'style-loader', 'css-loader', 'postcss-loader' ] }, { test: /.scss$/, use: [ 'style-loader', 'css-loader', 'sass-loader', 'postcss-loader' ] }, { test: /.js$/, exclude: /node_modules/, use: [ 'ng-annotate-loader', 'babel-loader' ] }, { test: /.html$/, use: [ 'html-loader' ] }, { test: /.(jpg|png)$/, loader: "file-loader" }, { test: /.(ttf|eot|svg)(\?v=[0-9].[0-9].[0-9])?$/, loader: "file-loader" }, { test: /.woff(2)?(\?v=[0-9].[0-9].[0-9])?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" } ] }, plugins: [ new webpack.optimize.OccurrenceOrderPlugin(), //new webpack.NoErrorsPlugin(), //FailPlugin, new HtmlWebpackPlugin({ template: conf.path.src('index.html') }), new webpack.LoaderOptionsPlugin({ options: { postcss: () => [autoprefixer] }, debug: true }), new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", "window.jQuery": "jquery", "window.$": "jquery" }) ], devtool: 'source-map', output: { path: path.join(process.cwd(), conf.paths.tmp), filename: 'index.js' }, entry: ./${conf.path.src('index')} };

cdxf commented 7 years ago

After 1.0.0 released, everything is working perfectly now. Thank FountainJS team 👍

Swiip commented 7 years ago

Cool! Thanks for the feedback! 🎉 🎉