到目前为止,我一直试图使用env预设失败.我浏览,其他人已经提出了这样的问题的git 这个,并采取了一些那似乎为别人工作的建议,但至今没有运气.
这是我正在使用的:
的package.json
"bundle": "browserify ./client/app.js -d -o ./public/o.js -t [ babelify --presets [ env ] ]",
"devDependencies": {
"@babel/cli": "^7.0.0-beta.40",
"@babel/preset-env": "^7.0.0-beta.40",
"babel-core": "^6.26.0",
"babelify": "^8.0.0"
...
Run Code Online (Sandbox Code Playgroud)
这是错误:
Error: Couldn't find preset "env" relative to directory "/Users/user/Documents/git/ts/client" while parsing file: /Users/user/Documents/git/ts/client/app.js
Run Code Online (Sandbox Code Playgroud)
我可能遗失的任何东西?
我只想编写一个操作来对状态执行相同的 CRUD 操作,只是在状态的不同部分上执行,同时保持类型安全。
例如,我想使用以下操作将集合操作应用于具有泛型类型的任何切片T:
export class Set_Entity<T> {
static readonly type = '[Entity] Set';
constructor(public payload: <T>) {}
}
Run Code Online (Sandbox Code Playgroud)
这是有问题的,因为类型总是相同的。是否可以以某种方式装饰此类,以便type在将其用作 时可以传入唯一的属性@Action?
就像是:
/* action* /
class Set_Entity<T> {
constructor(public entity: string, public payload: <T>) {}
}
/* state */
@Action(Set_Entity('[Groups] Set Group'/* <-- Changes the `type` property */))
set_group(
context: StateContext<Model>,
action: SetEntity<{entity: string, payload: Group}>,
) {
const entity = action.entity;
const data = action.payload;
context.patchState({ [entity]: data });
}
/* facade or …Run Code Online (Sandbox Code Playgroud) 我在 Firefox 51.0.1 控制台中收到此错误:
downloadable font: maxp: bad max_zones: 0 (font-family: "t" style:normal weight:normal stretch:normal src index:0) source: data:application/font-woff2;base64,d09GMgABAAAAAADcAAoAAAAAAggAAACWAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABk4ALAoUNAE2AiQDCAsGAAQgBSAHIBtvAcieB3aD8wURQ+TZazbRE9HvF5vde4KCYGhiCgq/NKPF0i6UIsZynbP+Xi9Ng+XLbNlmNz/xIBBqq61FIQRJhC/+QA/08PJQJ3sK5TZFMlWzC/iK5GUN40psgqvxwBjBOg6JUSJ7ewyKE2AAaXZrfUB4v+hze37ugJ9d+DeYqiDwVgCawviwVFGnuttkLqIMGivmDg (unknown)
Chrome 不会显示这一点,而 Safari 会显示几个警告,说明Unexpected CSS token: : woff.css:1:#where#是 4 位数字。我的项目目录中没有 woff.css 文件,只有 woff.json 和 woff2.json,所以我不知道该怎么做。
有任何想法吗?
我的项目中需要一个模块来下载私有的npm软件包。为此,我正在使用一个.npmrc文件来提供下载软件包所需的只读令牌。为了将npm提供的令牌保留在文件之外,我希望将其添加为环境变量,并使其在文件中扩展。例如:
# .npmrc
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
Run Code Online (Sandbox Code Playgroud)
NPM_TOKEN在安装引用之前,我不知道如何将其添加到环境中。我尝试使用npm预安装脚本:
"preinstall": "NPM_READ_ONLY_TOKEN=my_token_goes_here_foo_bar"**
但是我仍然遇到同样的错误:
Error: Failed to replace env in config: ${NPM_READ_ONLY_TOKEN}
Run Code Online (Sandbox Code Playgroud)
我尝试使用echo命令进行测试,以查看是否preinstall在.npmrc变量扩展之前运行,但显然没有。我会收到错误,但看不到我的回声日志。我似乎在这里错过了一些东西。
我知道将令牌放入package.json会破坏将令牌从.npmrc文件中拉出的目的。我实际上正在使用提供环境配置服务的服务,该服务将用于运行命令并获取所需的令牌。例如TOKEN=config_service_value。
我对 pull_request 有一个 Github 操作,并尝试在作业之间缓存 node_modules。我只能看到缓存在作业重新运行时工作,但在打开新 PR 时却看不到,即使我的 node_modules 没有任何更改。
这是设计使然吗?
每次它在新的 PR 中运行时,我都会在作业中看到以下输出:
Run actions/cache@v2
with:
path: ~/.npm
key: Linux-build-cache-node-modules-83fc6365b85dd061416fccd5993d48c2003c388bb2184fd57f28d1041d9d261e
restore-keys: Linux-build-cache-node-modules-
Linux-build-
Linux-
env:
cache-name: cache-node-modules
Cache not found for input keys: Linux-build-cache-node-modules-83fc6365b85dd061416fccd5993d48c2003c388bb2184fd57f28d1041d9d261e, Linux-build-cache-node-modules-, Linux-build-, Linux-
Run Code Online (Sandbox Code Playgroud)
然而,重新运行作业将享受缓存命中:
Run actions/cache@v2
Received 54525952 of 109978126 (49.6%), 51.8 MBs/sec
Received 109978126 of 109978126 (100.0%), 67.8 MBs/sec
Cache Size: ~105 MB (109978126 B)
/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/0bdf436d-9d4d-4397-b8ed-5910ff503949/cache.tzst -P -C /home/runner/work/argutopia/argutopia
Cache restored successfully
Cache restored from key: Linux-build-cache-node-modules-83fc6365b85dd061416fccd5993d48c2003c388bb2184fd57f28d1041d9d261e
Run Code Online (Sandbox Code Playgroud)
这是我的action yml供参考: …
该文件说,安装与本地路径(例如依赖npm install ../module --save)将标准化的依赖相对路径中的package.json,如
"dependencies": {
"bar": "file:../foo/bar"
}
Run Code Online (Sandbox Code Playgroud)
但是,这里提到的v3 +似乎并非如此。
这就是我的路径npm install ../myModule --save:
"dependencies": {
"bar": "file:///home/aFolder/Documents/git/project/modules/myModule"
}
Run Code Online (Sandbox Code Playgroud)
该路径仅在我的系统上有效,因此,我需要如第一个示例中所示的相对路径。似乎这将是一个非常普遍的用例。
是否可以使用相对路径保存依赖项?
尝试了解此处的ngrx/data 实体数据服务示例,其中显示“创建实体数据服务”。在展示该服务之后,文档继续展示如何在组件中使用 ngrx/data。我感兴趣的组件部分是这样的:
getHeroes() {
this.heroService.getAll();
}
Run Code Online (Sandbox Code Playgroud)
文档声明getAll()发起一个 HTTP 请求,但我不确定这个请求实际上是在哪里或如何发出的。在ngrx-data 存储库中。它指出用以下代码替换 HeroService:
import { Injectable } from '@angular/core';
import {
EntityCollectionServiceBase,
EntityCollectionServiceElementsFactory
} from 'ngrx-data';
import { Hero } from '../core';
@Injectable({ providedIn: 'root' })
export class HeroService extends EntityCollectionServiceBase<Hero> {
constructor(serviceElementsFactory: EntityCollectionServiceElementsFactory) {
super('Hero', serviceElementsFactory);
}
}
Run Code Online (Sandbox Code Playgroud)
文档指出ngrx-data handles getting and saving our data for us。太好了,但我不知道获取数据是在哪里发生的。我克隆了存储库,检查了finish分支,但找不到到达端点的东西。
http.get(${api}/heroes)例如,曾经调用获取所有英雄的服务getAll(),但是被上面的代码替换了,那么这些调用发生在哪里呢?
我注意到EntityCollectionServiceBase有一个getAll()方法。但是该服务的配置在哪里进行以注册相应的端点呢?我确信我在这里遗漏了一些非常简单的东西。
FirebaseonAuthStateChanged()在 Chrome 中返回用户凭据,但在 Firefox 中不返回:
可能的原因是什么?
更新:这是重现问题所需的最少代码:
var firebase = require("firebase/app"),
C = require("./constants.js");
require("firebase/auth");
firebase.initializeApp(C.FIREBASE_CONFIG);
firebase.auth().onAuthStateChanged(function(user) {
console.log('user is ' + user);
})
Run Code Online (Sandbox Code Playgroud)
我的应用程序中有更多代码,但在剥离所有内容后,这是唯一运行的代码,但问题仍然存在:
I need to compile multiple sass files in one directory into multiple corresponding css files in another directory. Eg:
src/folder1/file1.scss --compiles to-- public/file1.css
src/folder2/file2.scss --compiles to-- public/file2.css
Run Code Online (Sandbox Code Playgroud)
Here is the command I am using:
./src/*/*.scss ./public
Run Code Online (Sandbox Code Playgroud)
Prior to attempting this, I was compiling all .scss files in place using just ./src/*/*.scss, and was getting the corresponding .css files in their respective directories. Trying to dump these in a different directory, however, is not working. What is happening instead is …
我正在尝试设置滚动条的轨道.每当我设计赛道时:
div::-webkit-scrollbar-track {
background-color: blue;
}
Run Code Online (Sandbox Code Playgroud)
没有什么变化.
每当我设置滚动条的样式时:
div::-webkit-scrollbar {
background-color: blue;
}
Run Code Online (Sandbox Code Playgroud)
整个滚动条是蓝色的,没有可见的拇指
我在这里错过了什么?
编辑:
我在Chrome工作.奇怪的是,我所有溢出容器中的滚动条刚刚开始出现.在它们不可见之前,滚动拇指只会在悬停或滚动时出现(不记得哪个,但它肯定并不总是存在).Firefox似乎正在提供所需的行为.
最近Chrome滚动条有什么变化吗?