小编Nat*_*han的帖子

Loader.moduleStrategy 处出现意外标记“<”

我正在使用 PM2 在一个 Docker 容器中运行后端 Express 应用程序和 React.JS 应用程序。我的后端 Nodejs Express 应用程序工作正常,它只是 React 应用程序。

我有一个初始错误:Cannot use import statement outside a module我可以通过"type": "module"在我的package.json文件中添加: 来修复该错误。这修复了该错误,但现在我收到一个新错误:Unexpected token '<' at Loader.moduleStrategy我假设这是一个ESLINT错误。我使用的是 JavaScript,而不是 TypeScript。

我尝试安装,"babel-preset-react"因为这显然在谷歌搜索后修复了这个新错误,但它不起作用。

node.js npm reactjs pm2

6
推荐指数
0
解决办法
2602
查看次数

无法为 macOS 的 com.apple.weatherkit.authservice 生成 jwt 令牌

我试图获取我所在位置当前的天气,但是我得到以下信息:

无法为 com.apple.weatherkit.authservice 生成 jwt 令牌,并出现错误:Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2“(null)”

    class LocationManager: NSObject, ObservableObject{

        @Published var currentLocation: CLLocation?
        private let locationManager = CLLocationManager()

        override init(){
            super.init()
            locationManager.desiredAccuracy = kCLLocationAccuracyBest
            locationManager.distanceFilter = kCLDistanceFilterNone
            locationManager.requestAlwaysAuthorization()
            locationManager.startUpdatingLocation()
            locationManager.delegate = self
    
    }
}
extension LocationManager: CLLocationManagerDelegate{
    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    
        guard let location = locations.last, currentLocation == nil else {return}
    
        DispatchQueue.main.async {
            self.currentLocation = location
        }
    }
    func locationManager(_ manager: CLLocationManager,
                     didFailWithError error: Error) {
        print( "location manager failed with error \(error)" …
Run Code Online (Sandbox Code Playgroud)

macos swift swiftui weatherkit

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

Nodejs Fetch API:无法验证第一个证书

我在我的 Philips Hue 项目中使用 fetch API 模块,当我调用本地 IP 地址(我的集线器)时,它会在标题中产生该错误。

const fetch = require('node-fetch');
const gateway = "192.168.0.12";
const username = "username";

let getLights = function(){
    fetch(`https://${gateway}/api/${username}/lights`, {
        method: 'GET'
    }).then((res) => {
        return res.json();
    }).then((json) => {
        console.log(json);
    });
}


module.exports = {getLights};
Run Code Online (Sandbox Code Playgroud)

任何安全的解决方案最终都会进入公共互联网,让我可以从任何地方访问我的灯吗?

http fetch node.js philips-hue

4
推荐指数
1
解决办法
1万
查看次数

Blazor EditForm '模型是一种类型,在给定的上下文中无效'

我有这个简单的模型:

using System.ComponentModel.DataAnnotations;

namespace BlazorApp.Data
{
    public class DataModel
    {

        [Required]
        [Range(1, 500, ErrorMessage = "Width needs to be above 1m and below 500m")]
        public int Width { get; set; }

        [Required]
        [Range(1, 500, ErrorMessage = "Length needs to be above 1m and below 500m")]
        public int Length { get; set; }

        [Required]
        [Range(1, 500, ErrorMessage = "Height needs to be above 1m and below 500m")]
        public int Height { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的 Razor 文件,我正在尝试将模型用于:

<EditForm Model="@BlazorApp.Data.DataModel" …
Run Code Online (Sandbox Code Playgroud)

.net html c# asp.net blazor

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

标签 统计

node.js ×2

.net ×1

asp.net ×1

blazor ×1

c# ×1

fetch ×1

html ×1

http ×1

macos ×1

npm ×1

philips-hue ×1

pm2 ×1

reactjs ×1

swift ×1

swiftui ×1

weatherkit ×1