2017-07-04 47 views
0

我很抱歉这个简短的问题。我不知道如何部署angular2应用程序,所以我不知道该写些什么来帮助我。我需要部署生产。当我运行此命令npm build -prod,它的确定,复制所有的JS和HTML DIST文件夹,但是当我在浏览器中打开index.html的应用程序不启动,并在日志中是这样的:生产构建 - 不打开应用程序

/E:/styles.a530fc809103522200ce.bundle.css Failed to load resource: net::ERR_FILE_NOT_FOUND 
inline.64b91d2d61fb76e9d35a.bundle.js Failed to load resource: net::ERR_FILE_NOT_FOUND 
polyfills.fe38fa94cd758b43a148.bundle.js Failed to load resource: net::ERR_FILE_NOT_FOUND 
scripts.42e3c7ff6b40c17280bd.bundle.js Failed to load resource: net::ERR_FILE_NOT_FOUND 
vendor.7b7007a424e50f334b56.bundle.js Failed to load resource: net::ERR_FILE_NOT_FOUND 
main.5f1b617b49bf3e0d0eaa.bundle.js Failed to load resource: net::ERR_FILE_NOT_FOUND 
jquery-3.2.1.slim.min.js:2 jQuery.Deferred exception: $(...).select2 is not a function TypeError: $(...).select2 is not a function 
    at HTMLDocument.<anonymous> (file:///E:/User/antos/Dokumenty/Projects/PCL%20VA/ProLight/ProLight.Client/dist/index.html:26:21) 
    at j (https://code.jquery.com/jquery-3.2.1.slim.min.js:2:30203) 
    at k (https://code.jquery.com/jquery-3.2.1.slim.min.js:2:30517) undefined 
r.Deferred.exceptionHook @ jquery-3.2.1.slim.min.js:2 
/E:/favicon.ico Failed to load resource: net::ERR_FILE_NOT_FOUND 
jquery-3.2.1.slim.min.js:2 Uncaught TypeError: $(...).select2 is not a function 
    at HTMLDocument.<anonymous> (index.html:26) 
    at j (jquery-3.2.1.slim.min.js:2) 
    at k (jquery-3.2.1.slim.min.js:2) 

我不不知道哪里可以成为问题,我不知道我必须告诉你哪些文件。请告诉我你想看哪些文件。

+0

在'一的WebPack-DEV-服务器运行dev'模式,做ü有一个服务器的NodeJS服务于' dist'文件?你在浏览器中访问的网址是什么? – Dhyey

+0

您需要在服务器上托管应用程序。 – Ploppy

+0

这是下一个问题。我没有nodejs服务器,我使用IIS。我试图在浏览器中只打开index.html,我认为这是工作。 – bluray

回答

0

我将建立的文件复制到服务器中的文件夹中。我添加了web.config并将应用程序添加到IIS DefaultAppPool。而我得到这个错误:

 GET http://server/inline.64b91d2d61fb76e9d35a.bundle.js 
    server/:36 GET 
http://server/polyfills.fe38fa94cd758b43a148.bundle.js 
    server/:17 GET 
http://server/styles.a530fc809103522200ce.bundle.css 
    server/:36 GET 
http://server/scripts.42e3c7ff6b40c17280bd.bundle.js 
    server/:36 GET 
http://server/vendor.7b7007a424e50f334b56.bundle.js 
    server/:36 GET 
http://server/main.5f1b617b49bf3e0d0eaa.bundle.js 
    (index):36 GET 
http://server/inline.64b91d2d61fb76e9d35a.bundle.js 
    (index):36 GET 
http://server/polyfills.fe38fa94cd758b43a148.bundle.js 
    (index):36 GET 
http://server/scripts.42e3c7ff6b40c17280bd.bundle.js 
    (index):36 GET 
http://server/vendor.7b7007a424e50f334b56.bundle.js 
    (index):36 GET 
http://server/main.5f1b617b49bf3e0d0eaa.bundle.js 
    jquery-3.2.1.slim.min.js:2 jQuery.Deferred exception: $(...).select2 is not a function TypeError: $(...).select2 is not a function 
     at HTMLDocument.<anonymous> (http://sigma913/ProLight.Client/:26:21) 
     at j (https://code.jquery.com/jquery-3.2.1.slim.min.js:2:30203) 
     at k (https://code.jquery.com/jquery-3.2.1.slim.min.js:2:30517) undefined 
    r.Deferred.exceptionHook @ jquery-3.2.1.slim.min.js:2 
    k @ jquery-3.2.1.slim.min.js:2 
    jquery-3.2.1.slim.min.js:2 Uncaught TypeError: $(...).select2 is not a function 
     at HTMLDocument.<anonymous> ((index):26) 
     at j (jquery-3.2.1.slim.min.js:2) 
     at k (jquery-3.2.1.slim.min.js:2) 

这里是我的web.config:

<configuration> 
    <system.webServer> 
     <handlers> 
      <clear /> 
      <add 
       name="StaticFile" 
       path="*" verb="*" 
       modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" 
       resourceType="Either" 
       requireAccess="Read" /> 
     </handlers> 
     <staticContent> 
      <mimeMap fileExtension=".*" mimeType="application/octet-stream" /> 
     </staticContent> 
    </system.webServer> 
</configuration> 
相关问题