Skip to content

npm run build:prod fails with assetsTypeError on fresh install #473

Closed

Description

@tobek
  • I'm submitting a ...

[:heavy_check_mark:] bug report
[ ] feature request
[ ] question about the decisions made in the repository


Just cloned the repo and installed dependencies etc. and was able to run it with npm start and view the page in my browser. However, when I run npm run build:prod it fails. Output:

$ npm run build:prod

> angular2-webpack-starter@4.0.0 prebuild:prod /Users/gob/tmp/angular2-webpack-starter
> npm run clean:dist


> angular2-webpack-starter@4.0.0 clean:dist /Users/gob/tmp/angular2-webpack-starter
> rimraf dist


> angular2-webpack-starter@4.0.0 build:prod /Users/gob/tmp/angular2-webpack-starter
> node --max-old-space-size=4096 ./node_modules/webpack/bin/webpack --config config/webpack.prod.js  --progress --profile --colors --display-error-details --display-cached --bail

root directory: /Users/gob/tmp/angular2-webpack-starter
14957ms build modules
21ms seal
176ms optimize
587ms hashing
121ms create chunk assets
21589ms additional chunk assets
 80% optimize chunk assetsTypeError: callback is not a function
    at Gzip.onEnd (zlib.js:227:5)
    at emitNone (events.js:72:20)
    at Gzip.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:903:12)
    at doNTCallback2 (node.js:439:9)
    at process._tickCallback (node.js:353:17)

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build:prod"
npm ERR! node v4.2.1
npm ERR! npm  v2.10.0
npm ERR! code ELIFECYCLE
npm ERR! angular2-webpack-starter@4.0.0 build:prod: `node --max-old-space-size=4096 ./node_modules/webpack/bin/webpack --config config/webpack.prod.js  --progress --profile --colors --display-error-details --display-cached --bail`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular2-webpack-starter@4.0.0 build:prod script 'node --max-old-space-size=4096 ./node_modules/webpack/bin/webpack --config config/webpack.prod.js  --progress --profile --colors --display-error-details --display-cached --bail'.
npm ERR! This is most likely a problem with the angular2-webpack-starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node --max-old-space-size=4096 ./node_modules/webpack/bin/webpack --config config/webpack.prod.js  --progress --profile --colors --display-error-details --display-cached --bail
npm ERR! You can get their info via:
npm ERR!     npm owner ls angular2-webpack-starter
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/gob/tmp/angular2-webpack-starter/npm-debug.log

The contents of npm-debug.log (redundant bits excluded):

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build:prod' ]
2 info using npm@2.10.0
3 info using node@v4.2.1
4 verbose run-script [ 'prebuild:prod', 'build:prod', 'postbuild:prod' ]
5 info prebuild:prod angular2-webpack-starter@4.0.0
6 verbose unsafe-perm in lifecycle true
7 info build:prod angular2-webpack-starter@4.0.0
8 verbose unsafe-perm in lifecycle true
9 info angular2-webpack-starter@4.0.0 Failed to exec build:prod script
10 verbose stack Error: angular2-webpack-starter@4.0.0 build:prod: `node --max-old-space-size=4096 ./node_modules/webpack/bin/webpack --config config/webpack.prod.js  --progress --profile --colors --display-error-details --display-cached --bail`
10 verbose stack Exit status 1
10 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
10 verbose stack     at emitTwo (events.js:87:13)
10 verbose stack     at EventEmitter.emit (events.js:172:7)
10 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
10 verbose stack     at emitTwo (events.js:87:13)
10 verbose stack     at ChildProcess.emit (events.js:172:7)
10 verbose stack     at maybeClose (internal/child_process.js:818:16)
10 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
11 verbose pkgid angular2-webpack-starter@4.0.0
12 verbose cwd /Users/gob/tmp/angular2-webpack-starter
[...]
20 verbose exit [ 1, true ]

No idea even where to begin debugging myself. I'm on OS X 10.11.1, node v4.2.1, just cloned repo today (Mar 27).

Activity

  1. aegyed91 commented on Mar 27, 2016

    @aegyed91

    have the very same problem here

  2. mbalex99 commented on Mar 28, 2016

    @mbalex99

    When I commented out the Compression plugin, it worked...

    In webpack.prod.js config file, I commented out

            /*new CompressionPlugin({
                algorithm: helpers.gzipMaxLevel,
                regExp: /\.css$|\.html$|\.js$|\.map$/,
                threshold: 2 * 1024
            })*/
  3. leonardoanalista commented on Mar 28, 2016

    @leonardoanalista

    I have the same problem I am using npm 3 with node 4.4.1. It works with block above commented out. Thanks for sharing.

  4. antonycooper commented on Mar 28, 2016

    @antonycooper

    The problem is with the "algorithm: helpers.gzipMaxLevel,".
    I haven't exploed the problem in depth, but "algorithm: 'gzip'" and it works for me.

  5. aegyed91 commented on Mar 28, 2016

    @aegyed91

    @antonycooper i investigated it, our helper isn't necessary anymore and algorithm: 'gzip' is what we need.. what is the default option so we can delete this line and the helper.

    check this line you can specify the compression level in options and it defaults to 9.

  6. antonycooper commented on Mar 28, 2016

    @antonycooper

    @tsm91 I just went to https://github.com/webpack/compression-webpack-plugin and used the default options from there.

  7. aegyed91 commented on Mar 28, 2016

    @aegyed91

    @antonycooper yep, that's perfect

  8. Spittal commented on Mar 28, 2016

    @Spittal
    Contributor

    I can confirm switching algorithm to 'gzip' works.

  9. PatrickJS commented on Mar 28, 2016

    @PatrickJS
    Owner

    can someone create a PR?

  10. added a commit that references this issue on Mar 28, 2016
    34772dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions