我宁愿新手意味着堆栈而我正在尝试使用bower来拉动一些组件.
我有我的.bowerrc文件,它提供了安装路径.
//.bowerrc
{
"directory": "public/libs"
}
Run Code Online (Sandbox Code Playgroud)
我有我的bower.json文件,如下所示:
// bower.json
{
"name": "starter-node-angular",
"version": "1.0.0",
"dependencies": {
"bootstrap": "latest",
"font-awesome": "latest",
"animate.css": "latest",
"angular": "latest",
"angular-route": "latest"
}
}
Run Code Online (Sandbox Code Playgroud)
当我安装凉亭我没有问题,甚至凉亭搜索工作完美.当我运行命令时:
bower install
Run Code Online (Sandbox Code Playgroud)
我收到以下消息:
Failed to read + path\bower.json
Unexpected token /
Run Code Online (Sandbox Code Playgroud)
我在尝试的时候得到同样的信息:
bower install jquery
Run Code Online (Sandbox Code Playgroud)
我试图改变文件的编码并使用json在线验证工具.
有任何想法吗??
我用express.js和mongoosejs建立了一个博客网站.一篇文章可能有一个或多个类别.当我创建一篇新文章时,我收到错误:
{ [CastError: Cast to ObjectId failed for value "[object Object]" at path "categories"]
message: 'Cast to ObjectId failed for value "[object Object]" at path "categories"',
name: 'CastError',
type: 'ObjectId',
value: [ [object Object] ],
path: 'categories' }
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我吗?相关代码如下:
在Article这样定义模型:
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var ArticleSchema = new Schema({
created: { type: Date, default: Date.now},
title: String,
content: String,
summary: String,
categories: [{
type: Schema.ObjectId,
ref: 'Category' }]
});
mongoose.model('Article', ArticleSchema);
Run Code Online (Sandbox Code Playgroud)
而Category模型定义如下:
var …Run Code Online (Sandbox Code Playgroud) 我正在构建一个基本的MEAN webapp并且是新的堆栈.我的前端正在运行,但只要我将以下行添加到app.js:
var mongoose = require('mongoose');
require('./models/test');
mongoose.connect('mongodb://localhost:3000/design-data-test');
Run Code Online (Sandbox Code Playgroud)
我在终端中收到以下错误:
Error: Cannot find module 'debug'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/username/node_modules/mongoose/node_modules/mquery/lib/mquery.js:11:13)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
Run Code Online (Sandbox Code Playgroud)
并且我的所有前端代码都停止运行.Mongodb正在默认端口上运行.
我该如何解决这个错误?
我正在构建一个MEAN Web应用程序,我希望很快就能在开放的互联网上部署.此应用程序的一部分包括由WebSockets支持的令人敬畏的Primus抽象层支持的聊天功能.当我编写聊天模块时,我们会想到是否对这些消息施加字符限制.
我的结论是,有一些限制可能是好的,但我不知道如何决定应该限制什么.它应该取决于我的服务器的强大程度吗?我应该选择一些合理的限制吗?究竟什么是合理的限制,为什么?
谷歌和Facebook这样的网络巨头如何决定应用程序的聊天字符限制应该是什么?有人只是说"嗯这看起来很合理",就是这样吗?
一些额外的谷歌搜索发现了一些关于Jabber聊天限制的问题,一个增加Blade和Soul MMO聊天角色限制的请求,以及关于Twitch聊天字符限制的评论,但我似乎无法找到任何表明基于Web的应用程序的典型聊天字符限制的内容,或者为什么它们首先受限于它们的方式.
我知道过去我自己和其他人知道在某些聊天应用程序中看似不必要的短字符限制.这可能会成为一个主要的烦恼,特别是在尝试复制和粘贴大量信息时.我想在保护服务器和带宽完整性的同时避免对用户造成烦恼,同时请记住,某些用户可能正在使用具有网络使用限制等的应用程序.
我正在开发的应用程序是一款游戏,但它有时会涉及一些重要的外交和玩家之间的战略讨论.对该用例有一个特定的建议会有所帮助,但是有一些基本原则来指导各种应用程序的聊天限制显然会更有帮助.
我为nodejs下载了universal-starter并开始从old angular-rc4迁移我的网站.但是当我必须实现身份验证时(在我的情况下它是存储在localStorage中的JWT),服务器没有localStorage和cookie,因此仅在客户端上呈现angular.
我遵循这个指南:https://github.com/angular/universal-starter/issues/148但它没有用.
以下是我的代码:
authentication.services.ts
import { OpaqueToken } from '@angular/core';
export let AUTH_SERVICES = new OpaqueToken('auth.services');
export interface AuthenticationService {
forgotPassword(email: any);
isAuthenticated();
getCurrentUser();
refreshToken();
signin(user : any);
signout();
signup(user : any);
}
Run Code Online (Sandbox Code Playgroud)
server.authentication.ts
import { Injectable } from '@angular/core';
import { AuthenticationService } from './authentication.services';
@Injectable()
export class ServerAuthenticationService implements AuthenticationService {
forgotPassword(email: any) {
throw new Error('Forgot password cannot be called while doing server side rendering');
}
isAuthenticated() {
return false;
}
getCurrentUser(){ …Run Code Online (Sandbox Code Playgroud) 假设我有三个组件:C1、C2 和 C3。
我想让 C2 成为C1 和 C3的孩子。并根据哪个组件是 C2 的父组件这一事实想要显示 HTML 文本 - “ C1 是我的父级”或“ c3 是我的父级”。这是我的问题的表面形式。我想在 c2 中访问父组件的名称,然后将相应地更改其innerHTML。
如何在angular2中访问父组件的名称?
我正在开发一个平均堆栈的应用程序.唯一的区别是我想在IIS而不是express.js中托管我的应用程序.这样做是否可行或可行?有哪些可能的优点和缺点?提前致谢.
我通过http:// localhost:3000/auth/register注册一个简单的Mean Application时遇到了主题错误,我只是用mean init命令创建了.pbkdf2或crypto正在生成错误,我不知道在哪里寻找它.
我做了很多不同的事情,比如清除npm缓存,使用npm等重新安装.请帮帮我.以下是一些更多信息.
Mean --version: 0.12.15
npm --version: 5.0.3
node --version: v8.1.0
bower --version: 1.8.0
gulp --version: CLI and Local: 3.9.1
Run Code Online (Sandbox Code Playgroud)
代码model.UserSchema.methods.hashPassword(d:\项目\平均\ CampaignBuilder \node_modules\meanio用户\服务器\型号\ user.js的)
/**
* Hash password
*
* @param {String} password
* @return {String}
* @api public
*/
UserSchema.methods.hashPassword = function(password) {
if (!password || !this.salt) return '';
var salt = new Buffer(this.salt, 'base64');
return crypto.pbkdf2Sync(password, salt, 10000, 64).toString('base64');
};
Run Code Online (Sandbox Code Playgroud)
注册页面调用http:// localhost:3000/api/register并生成500 …
我对堆栈完全陌生,我正面临着 Angular 的材料模块的一些问题。我正在尝试在我的代码中导入“@angular/material”模块,但每次导入时都会出错。错误如下:
ERROR in src/app/app.module.ts:5:32 - error TS2306: File '/Users/anmolsarraf/Desktop/MEAN Stack/mean-course/node_modules/@angular/material/index
.d.ts' is not a module.
Run Code Online (Sandbox Code Playgroud)
这是我的 package.json 文件:
{
"name": "mean-course",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animation": "^4.0.0-beta.8",
"@angular/animations": "~8.2.7",
"@angular/cdk": "^9.0.0",
"@angular/common": "~8.2.7",
"@angular/compiler": "~8.2.7",
"@angular/core": "~8.2.7",
"@angular/forms": "~8.2.7",
"@angular/material": "^9.0.0",
"@angular/platform-browser": "~8.2.7",
"@angular/platform-browser-dynamic": "~8.2.7",
"@angular/router": "~8.2.7",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": { …Run Code Online (Sandbox Code Playgroud) 从mean.io下载了mean stck zip,几分钟后进行了npm安装,但出现错误。请看截图。我该怎么办?
npm http 200 https://registry.npmjs.org/event-emitter/-/event-e
mitter-0.2.2.tgz
> mean@1.0.0 postinstall C:\ss\D1\google\04\mean\mean-stack
> ./node_modules/bower/bin/bower install
'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! weird error 1
npm ERR! not ok code 0
Run Code Online (Sandbox Code Playgroud)