简体   繁体   English

Angular 2项目的初始构建脚本?

[英]Script for initial build of Angular 2 project?

How can I write a script for npm that installs the node_modules in an angular 2 project and compiles the ts files. 我该如何为npm编写脚本,以将node_modules安装在angular 2项目中并编译ts文件。 This doesn't work: 这不起作用:

"scripts": {
"firstBuild": "npm install && tsc", 
....

I get the error: 我收到错误:

> npm firstBuild

Usage: npm <command>

where <command> is one of:

PS: PS:

I can run "start" : "tsc && concurrently \\"tsc -w\\" \\"lite-server\\" just like npm start , why can't I do npm firstBuild ? 我可以像npm start一样"start" : "tsc && concurrently \\"tsc -w\\" \\"lite-server\\"运行"start" : "tsc && concurrently \\"tsc -w\\" \\"lite-server\\" ,为什么我不能做npm firstBuild

I think you just forgot to use run . 我认为您只是忘记使用run

Try npm run firstBuild . 尝试npm run firstBuild

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM