简体   繁体   English

当我运行“ npm start”时正在运行哪些js文件?

[英]Which are the js files that are being run when I run “npm start”?

I am trying to pick up angularjs v2 using the official documentation provided. 我正在尝试使用提供的官方文档来获取angularjs v2。

I followed the instructions on this page. 我按照本页上的说明进行操作。

https://angular.io/docs/ts/latest/guide/setup.html https://angular.io/docs/ts/latest/guide/setup.html

After I run npm start , I see a webpage http://localhost:3000/ being launched automatically on my default browser. 运行npm start ,我会看到一个网页http:// localhost:3000 /在默认浏览器上自动启动。

I see several js files in the quickstart folder. 我在quickstart文件夹中看到了几个js文件。 Which are the js files that are being run and in what sequence? 哪些js文件正在运行,按什么顺序运行? Is there a main file that tells npm which files to run for npm start ? 是否有一个主文件告诉npm为npm start运行哪些文件? How does npm knows which files to run? npm如何知道要运行哪些文件?

In your package.json file there will be a "script" named "start". 在package.json文件中,将有一个名为“ start”的“脚本”。 The one you are running from is found here: https://github.com/angular/quickstart/blob/master/package.json 您可以在此处找到正在运行的程序: https : //github.com/angular/quickstart/blob/master/package.json

"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",

It is executing the command tsc && concurrently "tsc -w" "lite-server" 它正在同时执行命令tsc && concurrently "tsc -w" "lite-server"

For usage of the tsc and concurrently node packages check out npmjs.com: 有关tscconcurrently节点程序包的用法,请访问npmjs.com:

您可以在每个文件上发出一个alert(“ file name”)来查看哪个文件最先运行或console.log(“ file name”);

From npm help start npm help start

This runs an arbitrary command specified in the package's "start" property of its "scripts" object. 这将运行在程序包的“脚本”对象的“开始”属性中指定的任意命令。 If no "start" property is specified on the "scripts" object, it will run node server.js. 如果未在“脚本”对象上指定“开始”属性,它将运行节点server.js。

So open package.json 所以打开package.json

"scripts": {
  "test": "echo \"Error: no test specified\" && exit 1"
},

Just add something to it. 只需添加一些即可。

"scripts": {
  "test": "echo \"Error: no test specified\" && exit 1",
  "start": "arbitrary command"
},

暂无
暂无

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

相关问题 我试图运行sb-admin-bs4-angular2-master这是一个nodejs应用程序,当我运行npm install时出现以下错误 - I was trying to run sb-admin-bs4-angular2-master which is an nodejs app and getting the following error when i run npm install 当我尝试运行npm install时出错 - Error when I try to run npm install “npm run dev”和“npm start”的区别 - Difference between “npm run dev” and “npm start” 尝试运行npm install -g量角器时出错 - Error when I try to run npm install -g protractor 运行时Grunt正在删除我的CSS文件 - Grunt is deleting my CSS files when I run it 当我已经在node_module文件夹中拥有所有依赖项时,为什么必须运行'npm install' - Why is it necessary to run 'npm install' when I already have all the dependence in node_module folder 已知 NPM 不能在 Node.js v11.15.0 上运行我正在研究 angular js 所以不能降低版本? 该怎么办? - NPM is known not to run on Node.js v11.15.0 I am working on angular js so cant lower version? what to do? 命令运行->'protractor protractor.conf.js'和'npm run e2e'之间的区别 - Difference between command run ->'protractor protractor.conf.js' and 'npm run e2e ' 如果我有Rails后端并且在Angular.js上运行的客户端,如何创建实时通知系统? - How to create a real time notification system if I have a rails backend and clients which run on Angular.js? npm启动后,如何自动按角度分离js文件和ts文件? - How can separate js files and ts files automatically in angular after npm start?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM