简体   繁体   English

将AngularJS2应用程序部署到Bluemix时缺少node_modules

[英]Missing node_modules when deploying AngularJS2 application to Bluemix

We're trying to deploy an AngularJS2 application to bluemix but we're missing the folder "node_modules" after the application was deployed to the server. 我们正在尝试将AngularJS2应用程序部署到bluemix,但是在将应用程序部署到服务器之后,我们缺少了文件夹“ node_modules”。 We're using npm to build the application. 我们正在使用npm来构建应用程序。

I found the following post that is mentioning the problem: ( https://developer.ibm.com/answers/questions/181207/npm-install-within-subdirectory-not-creating-node.html ) 我发现以下提到该问题的帖子:( https://developer.ibm.com/answers/questions/181207/npm-install-within-subdirectory-not-creating-node.html

My question would now be: what's the recommended best practice? 我的问题现在是:建议的最佳做法是什么?

I believe you are installing the node modules using npm install , you also should save those module in your package.json file which you can do that by npm install --save . 我相信您正在使用npm install安装节点模块,还应该将那些模块保存在package.json文件中,您可以通过npm install --save

The recommended best practice would be to Setup a Build Pipeline . 建议的最佳做法是设置构建管道

There could be 3 stages or more: 可能存在3个或更多阶段:

  • Build Stage: It builds the app so doing things like npm install there so your folder node_modules gets created for you. 构建阶段:它会构建应用程序,以便在该处执行npm install ,以便为您创建文件夹node_modules
  • Test Stage: Tests the app so doing things like npm test would run all the tests in your app 测试阶段:测试应用程序,以便执行npm test将在您的应用程序中运行所有测试
  • Deploy Stage: Once build and deploy stage runs successfully, Deploy will actually deploy the app to the Bluemix domain. Deploy阶段:构建和部署阶段成功运行后,Deploy实际上会将应用程序部署到Bluemix域。

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

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