I've defined some scripts in my package.json, e.g.,
"config": {
"source": "./assets/stylesheets/civica-styles.scss",
"dist": "./dist/civica-styles.css",
"minCss": "./dist/civica-styles.min.css"
},
"scripts": {
"transpile": "cross-var node-sass $npm_package_config_source $npm_package_config_dist",
"minify": "cross-var cleancss -o $npm_package_config_minCss $npm_package_config_dist"
}
I can run these at the command line as follows
npm run transpile
I have set up a build in VSTS that performs the following initial tasks:
- Get Sources (get my code from the repo)
- npm install (installs the packages defined in my package.json)
Now I want to add a task that runs my transpile
defined in package.json
, so I added the following npm custom
task
- Display name => npm transpile
- Command => custom
- Command and arguments => run transpile
However the build fails with
2017-08-01T10:01:42.5125804Z ##[section]Starting: npm custom
2017-08-01T10:01:42.5125804Z ==============================================================================
2017-08-01T10:01:42.5125804Z Task : npm
2017-08-01T10:01:42.5125804Z Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Package Management.
2017-08-01T10:01:42.5125804Z Version : 1.0.3
2017-08-01T10:01:42.5125804Z Author : Microsoft Corporation
2017-08-01T10:01:42.5125804Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613746)
2017-08-01T10:01:42.5125804Z ==============================================================================
2017-08-01T10:01:43.3515881Z ##[error]TypeError: Cannot read property 'trim' of null
2017-08-01T10:01:43.3565858Z ##[section]Finishing: npm custom
Any ideas of how to execute an npm run script from a VSTS build task?