我在package.json中定义了一些脚本,例如,
"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"
}
我可以在命令行运行它们,如下所示
npm run transpile
我已经在VSTS中设置了一个执行以下初始任务的构建:
现在我要添加运行transpile
中定义的package.json
的任务,因此我添加了以下npm custom
任务
然而,构建失败并带有
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
有关如何从VSTS构建任务执行npm运行脚本的任何想法吗?