无法在本地主机上运行角度应用程序。无法加载资源vendor.js

时间:2020-04-10 11:41:27

标签: javascript node.js angular npm webpack

我能够成功编译代码。但是当我使用 '节点--max-old-space-size = 8192' 它编译成功。但是当我在浏览器中打开应用程序时 找不到资源vendor.js

enter image description here 我试过重新安装node和angularcli 在多种浏览器中尝试过但没有运气

以下是我正在使用的版本

`Angular CLI: 8.3.25
Node: 10.19.0
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package Version
------------------------------------------------------------
@angular-devkit/architect 0.803.25
@angular-devkit/build-angular 0.803.25
@angular-devkit/build-optimizer 0.803.25
@angular-devkit/build-webpack 0.803.25
@angular-devkit/core 8.3.25
@angular-devkit/schematics 8.3.25
@angular/cdk 8.2.3
@angular/cli 8.3.25
@angular/flex-layout 8.0.0-beta.27
@angular/material 8.2.3
@angular/material-moment-adapter 8.2.3
@ngtools/webpack 8.3.25
@schematics/angular 8.3.25
@schematics/update 0.803.25
rxjs 6.4.0
typescript 3.5.3
webpack 4.39.2`

代码成功编译并显示以下输出

node --max-old-space-size=8192 ./node_modules/@angular/cli/bin/ng serve --port 4200 --host 127.0.0.1 --disableHostCheck true
WARNING: Running a server with --disable-host-check is a security risk. See https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a for more information.
10% building 3/3 modules 0 activei 「wds」: Project is running at http://127.0.0.1:4200/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html

chunk {default~projects-global-dashboard-backups-crash-plan-crash-plan-module-ngfactory~projects-global-das~5d5ab8ed} default~projects-global-dashboard-backups-crash-plan-crash-plan-module-ngfactory~proj
ects-global-das~5d5ab8ed.js, default~projects-global-dashboard-backups-crash-plan-crash-plan-module-ngfactory~projects-global-das~5d5ab8ed.js.map (default~projects-global-dashboard-backups-crash-plan-cra
sh-plan-module-ngfactory~projects-global-das~5d5ab8ed) 386 kB [rendered]
chunk {default~projects-global-dashboard-backups-crash-plan-crash-plan-module-ngfactory~projects-global-das~cf85ff3c} default~projects-global-dashboard-backups-crash-plan-crash-plan-module-ngfactory~proj
ects-global-das~cf85ff3c.js, default~projects-global-dashboard-backups-crash-plan-crash-plan-module-ngfactory~projects-global-das~cf85ff3c.js.map (default~projects-global-dashboard-backups-crash-plan-cra
sh-plan-module-ngfactory~projects-global-das~cf85ff3c) 646 kB [rendered]
chunk {main} main.js, main.js.map (main) 2.07 MB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 130 kB [initial] [rendered]
chunk {projects-global-dashboard-backups-crash-plan-crash-plan-module-ngfactory} projects-global-dashboard-backups-crash-plan-crash-plan-module-ngfactory.js, projects-global-dashboard-backups-crash-plan-
crash-plan-module-ngfactory.js.map (projects-global-dashboard-backups-crash-plan-crash-plan-module-ngfactory) 180 kB [rendered]
chunk {projects-global-dashboard-companies-companies-companies-module-ngfactory} projects-global-dashboard-companies-companies-companies-module-ngfactory.js, projects-global-dashboard-companies-companies
-companies-module-ngfactory.js.map (projects-global-dashboard-companies-companies-companies-module-ngfactory) 275 kB [rendered]
chunk {projects-global-dashboard-feedback-feedback-module-ngfactory} projects-global-dashboard-feedback-feedback-module-ngfactory.js, projects-global-dashboard-feedback-feedback-module-ngfactory.js.map (
projects-global-dashboard-feedback-feedback-module-ngfactory) 623 kB [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 9.82 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 2.75 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 22.2 MB [initial] [rendered]
Date: 2020-04-10T11:01:25.887Z - Hash: a5225c1b1f84947d575b - Time: 113055ms
 Angular Live Development Server is listening on 127.0.0.1:4200, open your browser on http://127.0.0.1:4200/ 
i 「wdm」: Compiled successfully.

请帮助

2 个答案:

答案 0 :(得分:0)

能否请您检查一下index.html文件。它是否有<base href="/">

答案 1 :(得分:0)

请检查 nginx 日志,在那里您可以找到权限问题。

Nginx:

tail -f /usr/local/var/log/nginx/error.log

读/写访问:

sudo chmod -R 775 /usr/local/var/run/nginx/proxy_temp/

上面的命令解决了这个问题。