在我的 angular 6 应用程序中,我的 scss 文件中有以下内容:
.pictureplaceholder{
background-image: url("assets/images/profilepictureplaceholder/PersonPlaceholder.png");
}
Run Code Online (Sandbox Code Playgroud)
这是资源的正确路径。但我收到此错误。
ERROR in ./src/app/venueadmin/parentadminview/venueuserprofile/venueuserprofile.component.scss
(Emitted value instead of an instance of Error) CssSyntaxError: /home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/fixedsuitsandtables/src/app/venueadmin/parentadminview/venueuserprofile/venueuserprofile.component.scss:11:20: Can't resolve 'assets/images/profilepictureplaceholder/PersonPlaceholder.png' in '/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/fixedsuitsandtables/src/app/venueadmin/parentadminview/venueuserprofile'
9 |
10 | .pictureplaceholder{
> 11 | background-image: url('assets/images/profilepictureplaceholder/PersonPlaceholder.png');
| ^
12 | }
13 |
Run Code Online (Sandbox Code Playgroud)
我在资产文件夹中的其他图像正在工作。很奇怪。有谁知道这是什么吗?
使用rxjs-5-to-6-migrate的文档说明如下:
To refactor TypeScript code so that it doesn't depend on rxjs-compat, you can use rxjs-tslint.
npm i -g rxjs-tslint
rxjs-5-to-6-migrate -p [path/to/tsconfig.json]
Run Code Online (Sandbox Code Playgroud)
所以我做了那个然后复制了
我的tsconfig文件的根路径
rxjs-5-to-6-migrate -p [/home/ri
ckus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/frontendsuitsandtables/suitsandtables/tsconfig.json]
Run Code Online (Sandbox Code Playgroud)
但是当我运行命令时,我得到以下错误.
Running the automatic migrations. Please, be patient and wait until the execution completes.
child_process.js:643
throw err;
^
Error: Command failed: "/usr/local/lib/node_modules/rxjs-tslint/node_modules/.bin/tslint" -c "/usr/local/lib/node_modules/rxjs-tslint/rxjs-5-to-6-migrate.json" -p "[home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/frontendsuitsandtables/suitsandtables/tsconfig.json" --fix
at checkExecSyncError (child_process.js:603:11)
at Object.execSync (child_process.js:640:13)
at migrate (/usr/local/lib/node_modules/rxjs-tslint/rxjs-5-to-6-migrate.js:18:34)
at Object.<anonymous> (/usr/local/lib/node_modules/rxjs-tslint/rxjs-5-to-6-migrate.js:25:14)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at …Run Code Online (Sandbox Code Playgroud) 我正在使用 angular heroku 和 django。我一直注意到,当我使用 'ng build' 构建新的静态文件以添加到 django 然后推送到 heroku 时,heroku 实例显示的网站比我当前的代码版本落后几个版本。
在ngbuild将文件放入指定文件夹后,我今天尝试运行我的 django 本地服务器,
跑步 python manage.py collectstatic
它成功运行。
然后我运行我的 django 服务器,导航到我的页面并得到 500 响应。
因为我使用的是 angular,所以我将 django 服务器设置为休息后端。
其余服务使用的每个端点都以 url api/ 开头
所以 localdomain/api/ <-- 宁静的服务
localdomain 单独为 angular 应用程序提供服务。
当我尝试提供应用程序时,我只收到 500 服务器错误。
以下是我关于静态文件的所有设置:
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
#angular distro root
ANGULAR_APP_DIR = os.path.join(BASE_DIR, 'frontend/dist/')
#image distro root
ASSETS_DIR = os.path.join(BASE_DIR, 'frontend/dist/assets/') …Run Code Online (Sandbox Code Playgroud)