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

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

Closed
tobek opened this issue Mar 27, 2016 · 9 comments · Fixed by #476
Closed

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

tobek opened this issue Mar 27, 2016 · 9 comments · Fixed by #476

Comments

@tobek
Copy link
Contributor

tobek commented Mar 27, 2016

  • 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).

@aegyed91
Copy link

have the very same problem here

@mbalex99
Copy link

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
        })*/

@leonardoanalista
Copy link

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.

@antonycooper
Copy link

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

@aegyed91
Copy link

@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.

@antonycooper
Copy link

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

@aegyed91
Copy link

@antonycooper yep, that's perfect

@Spittal
Copy link
Contributor

Spittal commented Mar 28, 2016

I can confirm switching algorithm to 'gzip' works.

@PatrickJS
Copy link
Owner

can someone create a PR?

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

Successfully merging a pull request may close this issue.

7 participants