ngconf-2016-zones
ngconf-2016-zones copied to clipboard
npm run build fails on Ubuntu 14.04: SOLVED
I thought you should know that the command npm run build
fails on Ubuntu. I traced the cause to one incompatibility. The issue is in the line:
"copy": "cp src/{*.html,*.css,*.js} built/"
which produces the following error:
cp: cannot stat ‘src/{*.html,*.css,*.js}’: No such file or directory
npm uses sh
as the shell command call. Since Ubuntu 6.0, sh
points to dash
instead of bash
. dash
is significantly faster than bash
but lacks some bash
features such as brace expansion. I resolved the problem by creating two small files, copy-script.sh
and copy-templates-script.sh
and invoking them instead of the direct commands.
copy-script.sh
#! /bin/bash
cp src/{*.html,*.css,*.js} built/
copy-templates-script.sh
#! /bin/bash
cp src/app/{*.html,*.css} built/app/
changed package.json
:
"scripts": {
"postinstall": "typings install --ambient",
"clean": "rimraf built/",
"copy": "./copy-script.sh",
"copytemplates": "./copy-templates-script.sh",
"build": "tsc && npm run copy",
"watch": "tsc --watch",
"serve": "http-server -p 9090 -c-1",
"test": "karma start karma.conf.js"
},