我遇到错误:
./node_modules/ng2-charts/fesm2015/ng2-charts.js 中的错误
找不到模块:错误:无法解析/node_modules/ng2-charts/fesm2015 中的“chart.js”
我做了“npm install --save ng2-charts”。你能帮我理解为什么会抛出这个错误吗?
我的 package.json
"dependencies": {
"@angular/animations": "~8.2.9",
"@angular/common": "~8.2.9",
"@angular/compiler": "~8.2.9",
"@angular/core": "~8.2.9",
"@angular/fire": "^5.2.3",
"@angular/forms": "~8.2.9",
"@angular/platform-browser": "~8.2.9",
"@angular/platform-browser-dynamic": "~8.2.9",
"@angular/router": "~8.2.9",
"@ngrx/store": "^8.6.0",
"@ngrx/store-devtools": "^8.6.0",
"bootstrap": "^4.4.1",
"firebase": "^7.6.0",
"ng2-charts": "^2.2.3",
"rxjs": "~6.4.0",
"sweetalert2": "^9.5.3",
"tslib": "^1.10.0",
"zone.js": "~0.9.1" }
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.21",
"@angular/cli": "~8.3.8",
"@angular/compiler-cli": "~8.2.9",
"@angular/language-service": "~8.2.9",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1", …Run Code Online (Sandbox Code Playgroud) 以下代码可用于在 Firebase 中创建新用户,但在浏览器中出现以下错误,您能帮我理解为什么吗?
使用无效数据调用函数 DocumentReference.set()。不支持的字段值:未定义(在字段名称中找到)
代码:
export class AuthService {
private userSubscription: Subscription = new Subscription();
constructor(private afAuth: AngularFireAuth,
private router: Router,
private afDB: AngularFirestore,
private store: Store<AppState>) { }
initAuthListener() {
this.afAuth.authState.subscribe((fbUser: firebase.User) => {
if (fbUser) {
this.userSubscription = this.afDB.doc(`${fbUser.uid}/usuario`).valueChanges()
.subscribe((usuarioObj: any) => {
const newUser = new User(usuarioObj)
this.store.dispatch(new SetUserAction(newUser))
})
} else {
this.userSubscription.unsubscribe()
}
})
}
createUser(nombre: string, email: string, password: string) {
this.store.dispatch(new ActivarLoadingAction())
this.afAuth.auth
.createUserWithEmailAndPassword(email, password)
.then(resp => {
const user: User = …Run Code Online (Sandbox Code Playgroud) 我遇到这个错误:
error TS2488: Type 'Usuario' must have a '[Symbol.iterator]()' method
that returns an iterator.
Run Code Online (Sandbox Code Playgroud)
我的代码:
usuarios.reducers.ts
export interface UsuarioState {
users: Usuario[];
loaded: boolean;
loading: boolean;
error: any;
}
const initState: UsuarioState = {
users: [],
loaded: false,
loading: false,
error: null
}
export function usuariosReducer(state = initState, action: fromUsuariosActions.usuariosAcciones): UsuarioState {
switch (action.type) {
case fromUsuariosActions.CARGAR_USUARIOS:
return {
...state,
loading: true
}
case fromUsuariosActions.CARGAR_USUARIOS_SUCCESS:
return {
...state,
loading: false,
loaded: true,
users:[...action.usuarios]
}
Run Code Online (Sandbox Code Playgroud)
我已经添加"es5", "dom.iterable"到我的tsconfig.json …
运行“npm install”后出现这些错误,我运行了“npm install --g --product windows-build-tools”,我还删除了 node_modules、package-lock.json 并安装了 Visual Studio Community 2019但仍然有同样的问题...
C:\Users\myuser\Documents\GitHub\myRepo\node_modules\snappy> if not defined npm_config_node_gyp
"C:\Users\myuser\Documents\GitHub\myRepo\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )
else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Run Code Online (Sandbox Code Playgroud)
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking …Run Code Online (Sandbox Code Playgroud) angular ×3
npm ×2
typescript ×2
firebase ×1
ng2-charts ×1
node.js ×1
npm-install ×1
package.json ×1
windows ×1