我很抱歉这个简短的问题。我不知道如何部署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 :(得分: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>