更新到Angular 7.3.6后,在ng serve上出现以下错误:
./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js中的错误找不到模块:错误:无法解析“ core-js / es7 / reflect” '\ node_modules @ angular-devkit \ build-angular \ src \ angular-cli-files \ models'
这是我的package.json依赖项:
{
"name": "frontend",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^7.2.11",
"@angular/cdk": "^7.3.6",
"@angular/common": "^7.2.11",
"@angular/compiler": "^7.2.11",
"@angular/core": "^7.2.11",
"@angular/flex-layout": "^7.0.0-beta.24",
"@angular/forms": "^7.2.11",
"@angular/http": "^7.2.11",
"@angular/material": "^7.3.6",
"@angular/platform-browser": "^7.2.11",
"@angular/platform-browser-dynamic": "^7.2.11",
"@angular/router": "^7.2.11",
"adm-zip": "^0.4.13", …Run Code Online (Sandbox Code Playgroud) 我从git克隆了一个有角度的4项目.
当我转到项目的根文件夹并进行服务时.
我收到了以下错误.node_modules显示为空,您可能需要运行npm install
我该如何解决上述错误.
我已经构建了React Apps:
npm run build
Run Code Online (Sandbox Code Playgroud)
并安装全局服务包:
npm install -g serve
Run Code Online (Sandbox Code Playgroud)
并运行它:
serve -s build
Run Code Online (Sandbox Code Playgroud)
我怎么阻止它?
我试过serve help但它没有显示任何停止选项
选项:
Run Code Online (Sandbox Code Playgroud)-a, --auth Serve behind basic auth -c, --cache Time in milliseconds for caching files in the browser -n, --clipless Don't copy address to clipboard (disabled by default) -C, --cors Setup * CORS headers to allow requests from any origin (disabled by default) -h, --help Output usage information -i, --ignore Files and directories to ignore -o, --open Open local address in …
我正在将 React 应用程序部署到我的 Apache 服务器。
我可以在 my-ip:5001 上访问该应用程序,但是当我访问我的域时,它会显示“404 找不到所请求的路径”。顺便提一句。在使用 React 之前,域已设置并使用 html 文件。
我这样做了npm run build并将构建文件夹放置在服务器的根目录中。未对 package.json 文件进行任何更改。
我使用以下方式运行服务器: serve -s -l 5001
Apache 配置文件:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName somedomain.com
ServerAlias www.somedomain.com
ProxyRequests On
ProxyVia On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:5001/
ProxyPassReverse / http://localhost:5001/
</VirtualHost>
</IfModule>
Run Code Online (Sandbox Code Playgroud)
知道这里会发生什么吗?
我在服务器上上传了一个laravel项目;当我运行所有 ajax post 请求时,请求运行如下:
Request URL: http://example.com/user/register/
Request Method: POST
Status Code: 301 Moved Permanently
Run Code Online (Sandbox Code Playgroud)
然后运行:
Request URL: http://example.com/user/register
Request Method: GET
Status Code: 500 Internal Server Error (from disk cache)
Run Code Online (Sandbox Code Playgroud)
post方法改为get方法并返回错误;我该如何解决这个问题?
我尝试php artisan cache:clear php artisan config:clear php artisan view:clear
但也返回错误
我无法ng serve在开发模式下运行。
我已将 Angular v11 升级到 v12。从那时起,我的编译出现延迟,并且开发模式似乎无法启用。
我总是收到这样的警告:
****************************************************************************************
This is a simple server for use in testing or debugging Angular applications locally.
It hasn't been reviewed for security issues.
DON'T USE IT FOR PRODUCTION!
****************************************************************************************
Run Code Online (Sandbox Code Playgroud)
我的惰性块文件是这样的:
由于编译文件是在浏览器上设置的,因此需要花费大量时间来调试任何内容。
我已经检查了 enviroment.ts 变量并设置为:
export const environment = {
production: false,
api: 'http://127.0.0.1:8000'
};
Run Code Online (Sandbox Code Playgroud)
我的 Chrome Angular 扩展警告我,我正在生产中运行,即使我不想:
We detected an application built with production configuration. Angular DevTools only supports development builds.
Run Code Online (Sandbox Code Playgroud)
Angular.json 上的 ng 服务部分
"serve": {
"builder": …Run Code Online (Sandbox Code Playgroud) 我想复制 Vue.js 生成的 dist 文件夹并在 symfony 路由上提供它,我尝试过:
路线.yaml
vue:
path: /{path}
controller: App\Controller\ApiController::vue
methods: [GET]
requirements:
path: .*
Run Code Online (Sandbox Code Playgroud)
ApiController.php
public function vue()
{
$vuepath = __DIR__.'/../../public/dist/index.html';
return new Response(file_get_contents($vuepath));
}
Run Code Online (Sandbox Code Playgroud)
它启动时index.html不会加载 javascript 文件。我该如何送达我的申请?
如果我正在为 React 应用程序提供服务npm install -g serve; serve -s build,是否还可以使用位置代理?
例如:任何请求都https://example.com/api/*将被重定向到https://example.com:8000/api/*
我刚买了一台新的MacBook并在我的机器上安装了离子/ cordova,但唉"离子服务"不再重新加载HTML更改.具体来说,我看到它重新加载,但一旦重新加载完成,更改不会反映出来.奇怪的是,*.ts的更改重新加载!有任何想法吗?我是一个新手,但每次因为每一个小小的改变而不得不停止/启动服务器让我发疯 - 谢谢!
Ionic Framework: 2.0.0-rc.5
Ionic Native: 2.4.1
Ionic App Scripts: 1.0.1
Angular Core: 2.2.1
Angular Compiler CLI: 2.2.1
Node: 7.5.0
OS Platform: macOS Sierra
Navigator Platform: MacIntel
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Run Code Online (Sandbox Code Playgroud)
这是我在终端上看到的内容:
[23:10:04] build started ...
[23:10:04] transpile started ...
[23:10:08] transpile finished in 3.93 s
[23:10:08] webpack update started ...
[23:10:09] webpack update finished in 524 ms
[23:10:09] build finished in 4.46 s
Run Code Online (Sandbox Code Playgroud) 我已经成功构建了反应应用程序。我有点困惑构建后要做什么。服务不工作。还请回答如何处理 React 项目中的 server.js 文件以及它如何帮助部署
我的应用程序在本地正常运行。我也希望它在我的域上运行。