Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building demo fails #323

Closed
1 of 4 tasks
mmintel opened this issue Jun 13, 2017 · 2 comments
Closed
1 of 4 tasks

Building demo fails #323

mmintel opened this issue Jun 13, 2017 · 2 comments

Comments

@mmintel
Copy link

mmintel commented Jun 13, 2017

Hello,

my build command fails at "Building demo" with the error "TypeError: Cannot read property 'request' of undefined" (detailed message with debug info below). I am not sure where this comes from because my code does not contain any line that uses 'request'.

This issue is a:

  • Bug report
  • Feature request
  • Question / support request
  • Other

Example repo: https://github.com/mmintel/react-primer/tree/9c18434528cff7e66e1d08cf9bc5f94d63bfe07d

Which modules are installed in your project?

 ✘ user@bn-marcmintel-wlan  ~/Projekte/privat/react-primer   master  npm ls --depth=0
react-primer@0.0.1 /path/to/project/react-primer
├── @kadira/storybook@2.35.3
├── eslint@3.19.0
├── eslint-config-airbnb@15.0.1
├── eslint-plugin-import@2.3.0
├── eslint-plugin-jsx-a11y@5.0.3
├── eslint-plugin-react@7.0.1
├── node-pre-gyp@0.6.36 extraneous
├── nwb@0.16.3
├── nwb-sass@0.8.0
├── react@15.5.4
├── react-css-themr@2.1.2
└── react-dom@15.5.4

npm ERR! extraneous: node-pre-gyp@0.6.36 /path/to/project/react-primer/node_modules/node-pre-gyp
npm ERR! peer dep missing: webpack@2, required by babel-loader@7.0.0
npm ERR! peer dep missing: webpack@^2.2.0, required by extract-text-webpack-plugin@2.1.0
npm ERR! extraneous: webpack@2.6.1 /path/to/project/react-primer/node_modules/babel-loader/node_modules/webpack
npm ERR! extraneous: webpack@2.6.1 /path/to/project/react-primer/node_modules/extract-text-webpack-plugin/node_modules/webpack
npm ERR! peer dep missing: webpack@^2.0.0, required by sass-loader@6.0.5
npm ERR! extraneous: webpack@2.6.1 /path/to/project/react-primer/node_modules/sass-loader/node_modules/webpack

Try setting the DEBUG environment variable to nwb before running to check what generated configuration looks like:

yarn build v0.24.5
$ nwb build-react-component
  nwb 1 nwb-* dependencies in package.json +0ms
  nwb nwb plugins: [ 'nwb-sass' ] +2ms
  nwb plugin config: { cssPreprocessors:
   { sass:
      { test: /\.s[ac]ss$/,
        loader: '/path/to/project/react-primer/node_modules/sass-loader/lib/loader.js',
        defaultConfig: 'sassLoader' } } } +6ms
  nwb imported config module from /path/to/project/react-primer/nwb.config.js +1ms
  nwb user config: { type: 'react-component',
  npm: { esModules: true, umd: false },
  webpack:
   { aliases: { components: '/path/to/project/react-primer/src/components' },
     rules: { 'sass-css': { options: { modules: true, localIdentName: '[local]__[hash:base64:5]' } } } },
  babel: {},
  karma: {} } +1ms
✔ Cleaning module
  nwb babel config: { presets:
   [ [ '/path/to/project/react-primer/node_modules/babel-preset-es2015/lib/index.js',
       { loose: true, modules: 'commonjs' } ],
     '/path/to/project/react-primer/node_modules/babel-preset-es2016/lib/index.js',
     '/path/to/project/react-primer/node_modules/babel-preset-stage-2/lib/index.js',
     '/path/to/project/react-primer/node_modules/babel-preset-react/lib/index.js' ],
  plugins:
   [ '/path/to/project/react-primer/node_modules/babel-plugin-transform-decorators-legacy/lib/index.js',
     [ '/path/to/project/react-primer/node_modules/babel-plugin-transform-react-remove-prop-types/lib/index.js',
       { mode: 'wrap' } ],
     [ '/path/to/project/react-primer/node_modules/babel-plugin-transform-runtime/lib/index.js',
       { helpers: false, polyfill: false, regenerator: true } ],
     '/path/to/project/react-primer/node_modules/babel-plugin-add-module-exports/lib/index.js' ],
  ignore: [ '.spec.js', '.test.js', '-test.js', '/__tests__/' ] } +13ms
✔ Creating ES5 build
  nwb babel config: { presets:
   [ [ '/path/to/project/react-primer/node_modules/babel-preset-es2015/lib/index.js',
       { loose: true, modules: false } ],
     '/path/to/project/react-primer/node_modules/babel-preset-es2016/lib/index.js',
     '/path/to/project/react-primer/node_modules/babel-preset-stage-2/lib/index.js',
     '/path/to/project/react-primer/node_modules/babel-preset-react/lib/index.js' ],
  plugins:
   [ '/path/to/project/react-primer/node_modules/babel-plugin-transform-decorators-legacy/lib/index.js',
     [ '/path/to/project/react-primer/node_modules/babel-plugin-transform-react-remove-prop-types/lib/index.js',
       { mode: 'wrap' } ],
     [ '/path/to/project/react-primer/node_modules/babel-plugin-transform-runtime/lib/index.js',
       { helpers: false, polyfill: false, regenerator: true } ] ],
  ignore: [ '.spec.js', '.test.js', '-test.js', '/__tests__/' ] } +692ms
✔ Creating ES6 modules build
✔ Cleaning demo
  nwb 1 nwb-* dependencies in package.json +552ms
  nwb nwb plugins: [ 'nwb-sass' ] +1ms
  nwb plugin config: { cssPreprocessors:
   { sass:
      { test: /\.s[ac]ss$/,
        loader: '/path/to/project/react-primer/node_modules/sass-loader/lib/loader.js',
        defaultConfig: 'sassLoader' } } } +1ms
  nwb imported config module from /path/to/project/react-primer/nwb.config.js +0ms
  nwb user config: { type: 'react-component',
  npm: { esModules: true, umd: false },
  webpack:
   { aliases: { components: '/path/to/project/react-primer/src/components' },
     rules: { 'sass-css': { options: { modules: true, localIdentName: '[local]__[hash:base64:5]' } } } },
  babel: {},
  karma: {} } +0ms
  nwb createWebpackConfig buildConfig: { babel: { presets: [ 'react' ] },
  devtool: 'source-map',
  entry: { demo: [ '/path/to/project/react-primer/demo/src/index.js' ] },
  output:
   { filename: '[name].[chunkhash:8].js',
     chunkFilename: '[name].[chunkhash:8].js',
     path: '/path/to/project/react-primer/demo/dist' },
  plugins: { html: { mountId: 'demo', title: 'react-primer 0.0.1 Demo' } } } +2ms
  nwb webpack config: { module:
   { rules:
      [ { test: /\.js$/,
          loader: '/path/to/project/react-primer/node_modules/babel-loader/lib/index.js',
          exclude: /node_modules/,
          options:
           { babelrc: false,
             cacheDirectory: true,
             presets:
              [ [ '/path/to/project/react-primer/node_modules/babel-preset-es2015/lib/index.js',
                  { loose: true, modules: false } ],
                '/path/to/project/react-primer/node_modules/babel-preset-es2016/lib/index.js',
                '/path/to/project/react-primer/node_modules/babel-preset-stage-2/lib/index.js',
                '/path/to/project/react-primer/node_modules/babel-preset-react/lib/index.js' ],
             plugins:
              [ '/path/to/project/react-primer/node_modules/babel-plugin-transform-decorators-legacy/lib/index.js',
                [ '/path/to/project/react-primer/node_modules/babel-plugin-transform-runtime/lib/index.js',
                  { helpers: false,
                    polyfill: false,
                    regenerator: true,
                    moduleName: '/path/to/project/react-primer/node_modules/babel-runtime' } ],
                '/path/to/project/react-primer/node_modules/babel-plugin-syntax-dynamic-import/lib/index.js' ] } },
        { test: /\.(gif|png|webp)$/,
          loader: '/path/to/project/react-primer/node_modules/url-loader/index.js',
          options: { limit: 1, name: '[name].[hash:8].[ext]' } },
        { test: /\.svg$/,
          loader: '/path/to/project/react-primer/node_modules/url-loader/index.js',
          options: { limit: 1, name: '[name].[hash:8].[ext]' } },
        { test: /\.jpe?g$/,
          loader: '/path/to/project/react-primer/node_modules/url-loader/index.js',
          options: { limit: 1, name: '[name].[hash:8].[ext]' } },
        { test: /\.(eot|otf|ttf|woff|woff2)$/,
          loader: '/path/to/project/react-primer/node_modules/url-loader/index.js',
          options: { limit: 1, name: '[name].[hash:8].[ext]' } },
        { test: /\.(mp4|ogg|webm)$/,
          loader: '/path/to/project/react-primer/node_modules/url-loader/index.js',
          options: { limit: 1, name: '[name].[hash:8].[ext]' } },
        { test: /\.(wav|mp3|m4a|aac|oga)$/,
          loader: '/path/to/project/react-primer/node_modules/url-loader/index.js',
          options: { limit: 1, name: '[name].[hash:8].[ext]' } },
        { test: /\.css$/,
          use:
           [ { loader: '/path/to/project/react-primer/node_modules/extract-text-webpack-plugin/loader.js',
               options: { omit: 1, remove: true } },
             { loader: '/path/to/project/react-primer/node_modules/nwb/node_modules/style-loader/index.js' },
             { loader: '/path/to/project/react-primer/node_modules/css-loader/index.js',
               options: { importLoaders: 1 } },
             { loader: '/path/to/project/react-primer/node_modules/nwb/node_modules/postcss-loader/lib/index.js',
               options:
                { plugins:
                   [ { [Function: plugin]
                       options:
                        { browsers: [ '>1%', 'last 4 versions', 'Firefox ESR', 'not ie < 9' ],
                          grid: false },
                       info: [Function],
                       postcssPlugin: 'autoprefixer',
                       postcssVersion: '6.0.2' } ] } } ] },
        { test: /\.s[ac]ss$/,
          use:
           [ { loader: '/path/to/project/react-primer/node_modules/extract-text-webpack-plugin/loader.js',
               options: { omit: 1, remove: true } },
             { loader: '/path/to/project/react-primer/node_modules/nwb/node_modules/style-loader/index.js' },
             { loader: '/path/to/project/react-primer/node_modules/css-loader/index.js',
               options:
                { importLoaders: 1,
                  modules: true,
                  localIdentName: '[local]__[hash:base64:5]' } },
             { loader: '/path/to/project/react-primer/node_modules/nwb/node_modules/postcss-loader/lib/index.js',
               options:
                { plugins:
                   [ { [Function: plugin]
                       options:
                        { browsers: [ '>1%', 'last 4 versions', 'Firefox ESR', 'not ie < 9' ],
                          grid: false },
                       info: [Function],
                       postcssPlugin: 'autoprefixer',
                       postcssVersion: '6.0.2' } ] } },
             { loader: '/path/to/project/react-primer/node_modules/sass-loader/lib/loader.js' } ] } ],
     strictExportPresence: true },
  output:
   { filename: '[name].[chunkhash:8].js',
     chunkFilename: '[name].[chunkhash:8].js',
     path: '/path/to/project/react-primer/demo/dist' },
  plugins:
   [ CaseSensitivePathsPlugin { options: {}, pathCache: {}, fsOperations: 0, primed: false },
     DefinePlugin { definitions: { 'process.env.NODE_ENV': '"production"' } },
     ExtractTextPlugin {
       filename: '[name].[contenthash:8].css',
       id: 1,
       options: { allChunks: true } },
     HashedModuleIdsPlugin {
       options:
        { hashFunction: 'md5',
          hashDigest: 'base64',
          hashDigestLength: 4 } },
     CommonsChunkPlugin {
       chunkNames: [ 'manifest' ],
       filenameTemplate: undefined,
       minChunks: undefined,
       selectedChunks: undefined,
       children: undefined,
       async: undefined,
       minSize: undefined,
       ident: '/path/to/project/react-primer/node_modules/nwb/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js0' },
     [Function: injectManifestPlugin],
     LoaderOptionsPlugin {
       options:
        { debug: false,
          minimize: true,
          test: { test: [Function: test] } } },
     UglifyJsPlugin {
       options:
        { compress: { warnings: false },
          output: { comments: false },
          sourceMap: true } },
     HtmlWebpackPlugin {
       options:
        { template: '/path/to/project/react-primer/node_modules/nwb/templates/webpack-template.html',
          filename: 'index.html',
          hash: false,
          inject: true,
          compile: true,
          favicon: false,
          minify: false,
          cache: true,
          showErrors: true,
          chunks: 'all',
          excludeChunks: [],
          title: 'react-primer 0.0.1 Demo',
          xhtml: false,
          chunksSortMode: 'dependency',
          mountId: 'demo' } } ],
  resolve:
   { extensions: [ '.js', '.json' ],
     alias: { components: '/path/to/project/react-primer/src/components' } },
  resolveLoader:
   { modules:
      [ 'node_modules',
        '/path/to/project/react-primer/node_modules/nwb/node_modules' ] },
  devtool: 'source-map',
  entry:
   { demo:
      [ '/path/to/project/react-primer/node_modules/nwb/polyfills.js',
        '/path/to/project/react-primer/demo/src/index.js' ] } } +108ms
✖ Building demo

Failed to compile with 1 error.

 ERROR  in   TypeError: Cannot read property 'request' of undefined

  - ExternalModuleFactoryPlugin.js:37 handleExternals
    [react-primer]/[webpack]/lib/ExternalModuleFactoryPlugin.js:37:33

  - ExternalModuleFactoryPlugin.js:46 next
    [react-primer]/[webpack]/lib/ExternalModuleFactoryPlugin.js:46:8

  - ExternalModuleFactoryPlugin.js:59 handleExternals
    [react-primer]/[webpack]/lib/ExternalModuleFactoryPlugin.js:59:7

  - ExternalModuleFactoryPlugin.js:79 ExternalModuleFactoryPlugin.<anonymous>
    [react-primer]/[webpack]/lib/ExternalModuleFactoryPlugin.js:79:5

  - NormalModuleFactory.js:246 applyPluginsAsyncWaterfall
    [react-primer]/[nwb]/[webpack]/lib/NormalModuleFactory.js:246:4

  - Tapable.js:196 NormalModuleFactory.applyPluginsAsyncWaterfall
    [react-primer]/[nwb]/[tapable]/lib/Tapable.js:196:70

  - NormalModuleFactory.js:230 NormalModuleFactory.create
    [react-primer]/[nwb]/[webpack]/lib/NormalModuleFactory.js:230:8

  - Compilation.js:382 Compilation._addModuleChain
    [react-primer]/[nwb]/[webpack]/lib/Compilation.js:382:17

  - Compilation.js:464 Compilation.addEntry
    [react-primer]/[nwb]/[webpack]/lib/Compilation.js:464:8

  - SingleEntryPlugin.js:22 SingleEntryPlugin.<anonymous>
    [react-primer]/[webpack]/lib/SingleEntryPlugin.js:22:15

  - Tapable.js:229 Compiler.applyPluginsParallel
    [react-primer]/[nwb]/[tapable]/lib/Tapable.js:229:14

  - Compiler.js:488
    [react-primer]/[nwb]/[webpack]/lib/Compiler.js:488:8

  - Tapable.js:131 Compiler.applyPluginsAsyncSeries
    [react-primer]/[nwb]/[tapable]/lib/Tapable.js:131:46

  - Compiler.js:481 Compiler.compile
    [react-primer]/[nwb]/[webpack]/lib/Compiler.js:481:7

  - Compiler.js:282 Compiler.runAsChild
    [react-primer]/[nwb]/[webpack]/lib/Compiler.js:282:7

  - compiler.js:70
    [react-primer]/[html-webpack-plugin]/lib/compiler.js:70:19

  - debuggability.js:300 Promise._execute
    [react-primer]/[bluebird]/js/release/debuggability.js:300:9

  - promise.js:483 Promise._resolveFromExecutor
    [react-primer]/[bluebird]/js/release/promise.js:483:18

  - promise.js:79 new Promise
    [react-primer]/[bluebird]/js/release/promise.js:79:10

  - compiler.js:69 Object.compileTemplate
    [react-primer]/[html-webpack-plugin]/lib/compiler.js:69:10

  - index.js:47 Compiler.<anonymous>
    [react-primer]/[html-webpack-plugin]/index.js:47:40

  - Tapable.js:229 Compiler.applyPluginsParallel
    [react-primer]/[nwb]/[tapable]/lib/Tapable.js:229:14


✨  Done in 6.80s.

Which versions of Node.js, npm and nwb are you using (if using it globally)?

node -v 8.1.0
npm -v 5.0.3
# If nwb is being used as a global install
nwb -v 0.16.3

Any idea?

@insin
Copy link
Owner

insin commented Jun 13, 2017

Looks like having the wrong version of Webpack can be a cause of this and storybook might be a factor, see this similar issue in create-react-app: facebook/create-react-app#2352

@mmintel
Copy link
Author

mmintel commented Jun 13, 2017

Oh yeah thanks, didn't find that one! Moving storybook to last dependency resolved this error.

@mmintel mmintel closed this as completed Jun 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants