小编Sai*_*var的帖子

Application.js 未在 Rails 6 中加载

我正在努力使 javascript 在 Rails 6 中工作。
由于某种原因,/app/javascript/packs/application.js文件似乎根本无法加载。因此,所有 JavaScript 内容都不起作用(如引导弹出窗口、工具提示等)。
我已经尽力按照官方文档设置了Rails 6。经过广泛的搜索和测试后,我无法理解为什么会发生这种情况。
任何帮助将不胜感激。

应用程序.js

// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.

require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
import "bootstrap"
import "../stylesheets/application"

document.addEventListener("turbolinks:load", () => {
    $('[data-toggle="tooltip"]').tooltip();
    $('[data-toggle="popover"]').popover();
})

// Uncomment …
Run Code Online (Sandbox Code Playgroud)

javascript ruby-on-rails webpack

6
推荐指数
1
解决办法
3298
查看次数

在一元运算符' - '之后缺少表达式

这是我的第一篇文章,因此对任何错误道歉.

我在Windows Powershell中运行了dotnet命令,它给了我如何使用它的说明:

Usage: dotnet [host-options] [command] [arguments] [common-options]

Common options:  
  -v|--verbose          Enable verbose output  
  -h|--help             Show help
Run Code Online (Sandbox Code Playgroud)

当我运行命令时

dotnet run -h|--help
Run Code Online (Sandbox Code Playgroud)

它给了我以下错误:

At line:1 char:17
+ dotnet run -h|--help
+                 ~
Missing expression after unary operator '--'.
At line:1 char:15
+ dotnet run -h|--help
+               ~~
Expressions are only allowed as the first element of a pipeline.
At line:1 char:17
+ dotnet run -h|--help
+                 ~~~~
Unexpected token 'help' in expression or statement.
    + CategoryInfo          : ParserError: …
Run Code Online (Sandbox Code Playgroud)

.net powershell .net-core

2
推荐指数
1
解决办法
1077
查看次数