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

Error: invalid signature: 0xadb1a754 #1

Closed
Birowsky opened this issue Apr 26, 2017 · 3 comments
Closed

Error: invalid signature: 0xadb1a754 #1

Birowsky opened this issue Apr 26, 2017 · 3 comments
Assignees

Comments

@Birowsky
Copy link

Birowsky commented Apr 26, 2017

I'm getting this error

Error: invalid signature: 0xadb1a754
    at /Users/Birowsky/Projects/Commercial/Dscova/Dscova - Frontend/node_modules/node-unzip-2/lib/parse.js:63:13
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
(node:79177) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot match against 'undefined' or 'null'.
(node:79177) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

for this config:

      new GoogleFontsWebpackPlugin({
        name: 'googlefonts',
        filename: 'googlefonts.css',
        path: 'assets/fonts/google/',
        local: true,
        fonts: [
          {
            family: 'Ubuntu',
            subsets: ['latin'],
            variants: ['400', '500', '700']
          }
        ]
      })

Everything looks ok in the google-webfonts-helper.
I tried with other families too. I constantly get this error.
Except when I try with 'Open Sans' as a family. Then there is no problem.
Help?

@gabiseabra gabiseabra self-assigned this Apr 27, 2017
@gabiseabra
Copy link
Owner

gabiseabra commented Apr 27, 2017

I can't reproduce this error with that same configuration but it seems to be an issue with node-unzip-2. Can you provide more info on your environment?

@Birowsky
Copy link
Author

Birowsky commented Apr 28, 2017

Well, I'm on a Mac 10.12.4, node 7.9.0, npm 4.2.0

part of my package.json looks like this:

    "webpack": "2.4.1",
    "webpack-config-utils": "2.1.0",
    "webpack-dev-server": "2.4.3",

If there's anything else useful I could share, do let me know.

@ismay
Copy link

ismay commented May 18, 2017

I have this as well. Same environment too, with this config:

const path = require('path')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const GoogleFontsPlugin = require('google-fonts-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const InlineChunkManifestHtmlWebpackPlugin = require('inline-chunk-manifest-html-webpack-plugin')
const PreloadWebpackPlugin = require('preload-webpack-plugin')
const SentryPlugin = require('webpack-sentry-plugin')
const StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin
const WebpackMd5Hash = require('webpack-md5-hash')
const webpack = require('webpack')

/**
 * Name of the entrypoint. Currently there's only one client-side entrypoint. The name is defined
 * here so that it can be referenced when extracting the asset names for the server-side template.
 */

const ENTRYPOINT = 'main'

/**
 * Transforms the webpack stats object. Parses it into arrays of assets that are in the proper
 * order for server-side use.
 */

function transformStats(stats) {
  const assetsByEntrypoint = stats.entrypoints[ENTRYPOINT].assets
  const js = assetsByEntrypoint.filter(asset => asset.endsWith('.js'))
  const dynamic = stats.assets
    .filter(asset => (asset.chunkNames.length === 0 && asset.name.endsWith('.js')))
    .map(asset => asset.name)

  return JSON.stringify({ js, dynamic })
}

module.exports = {
  entry: {
    [ENTRYPOINT]: './src/client/index.jsx'
  },
  output: {
    path: path.join(__dirname, 'dist', 'public'),
    filename: '[name].[chunkhash].js',
    chunkFilename: '[name].[chunkhash].js'
  },
  resolve: {
    extensions: ['.js', '.jsx'],
    modules: ['node_modules']
  },
  module: {
    rules: [
      {
        test: /\.js$|\.jsx$/,
        exclude: /(node_modules)/,
        loader: 'babel-loader'
      }
    ]
  },
  devtool: 'source-map',
  plugins: [

    /**
     * Clean dist before building.
     */

    new CleanWebpackPlugin(
      path.join(__dirname, 'dist', 'public'),
      { verbose: false }
    ),

    /**
     * Download google fonts to build folder
     */

    new GoogleFontsPlugin({
      fonts: [
        { family: 'Bitter', variants: ['400'] },
        { family: 'Crimson Text', variants: ['400'] }
      ]
    }),

    /**
     * Copy all static assets to dist.
     */

    new CopyWebpackPlugin([{ from: path.join(__dirname, 'src', 'static') }]),

    /**
     * Minify the generated js and pass along the sourcemaps.
     */

    new webpack.optimize.UglifyJsPlugin({
      sourceMap: true
    }),

    /**
     * Add all the necessary environment variables.
     */

    new webpack.EnvironmentPlugin([
      'NODE_ENV',
      'SPACE_ID',
      'CONTENT_DELIVERY_TOKEN',
      'PROD_TRACKING_ID',
      'SENTRY_CLIENT_KEY',
      'SENTRY_APP',
      'RELEASE',
      'BABEL_ENV'
    ]),

    /**
     * Generate static html.
     */

    new HtmlWebpackPlugin({
      template: path.join(__dirname, 'src', 'client', 'index.ejs'),
      filename: 'static.html',
      minify: {
        collapseWhitespace: true,
        removeComments: true
      }
    }),

    /**
     * Preload async chunks automatically
     */

    new PreloadWebpackPlugin({
      rel: 'preload'
    }),

    /**
     * Split chunks
     *
     * splitting passes modules from top to bottom, see also:
     * - https://github.com/webpack/webpack/issues/4638#issuecomment-292702190
     * - http://stackoverflow.com/a/43291641/5918874
     *
     * Extracts:
     *
     * - vendor chunk
     * - react chunk (react and react-dom)
     * - manifest chunk (webpack runtime)
     */

    new webpack.optimize.CommonsChunkPlugin({
      name: 'vendor',
      minChunks: (m) => /node_modules/.test(m.context)
    }),
    new webpack.optimize.CommonsChunkPlugin({
      name: 'react',
      minChunks: (m) => /node_modules\/(?:react\/|react-dom\/)/.test(m.context)
    }),
    new webpack.optimize.CommonsChunkPlugin({
      name: 'manifest',
      minChunks: Infinity
    }),

    /**
     * Enable deterministic builds, to prevent needless cache-busting
     *
     * - hash module ids so the module identifiers won't change across builds
     * - hash file contents with md5, so the hashes are based on the actual file contents
     * - export json that maps chunk ids to their resulting asset files, means that the manifest
     *   doesn't have to change if a chunk changes and inline the result in the html
     */

    new webpack.HashedModuleIdsPlugin(),
    new WebpackMd5Hash(),
    new InlineChunkManifestHtmlWebpackPlugin(),

    /**
     * Parse the webpack stats object and output a json file with the assets grouped by type
     */

    new StatsWriterPlugin({
      fields: null,
      transform: transformStats
    }),

    /**
     * Upload source and sourcemaps to Sentry
     */

    new SentryPlugin({
      organisation: 'ismay',
      project: 'ismaywolff-nl',
      apiKey: process.env.SENTRY_API_KEY,
      release: process.env.RELEASE
    })
  ]
}

antony referenced this issue in beyonk-group/google-fonts-webpack-plugin Oct 15, 2018
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

3 participants