Tag: 量angular器

Angular2路由连接到Express路由?

当通过URL访问我的angular2应用程序的路线不工作…快递正在渲染一个错误页面。 所以我有一个path( /docs )为静态内容和其他一些静态资源提供服务,然而, /被路由到一个由angular度2pipe理的index.html。所以通过打开应用程序根目录然后点击各种路由器链接可以到一个路线eg /tutorial/chapter/1 。 但是,因为这不是我的快速应用程序中的注册路线,如果我刷新页面,我会得到一个404。 我希望能够在浏览器中inputhttp://localhost:3000/tutorial/chapter/1并获取该页面。 如何设置快递路线的所有未定义的路线angular度,并让angular处理404? 这是我的app.js : var app = express(); // html view engine setup app.set('views', path.join(__dirname, '/ng2/views')); app.engine('html', require('jade').renderFile); app.set('view engine', 'html'); app.use(express.static('ng2/views')); app.use(express.static('ng2/public')); app.use('/node_modules', express.static(__dirname + '/node_modules')); // uncomment after placing your favicon in /public app.use(favicon(path.join(__dirname, 'ng2/public', 'favicon.png'))); app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); //all static […]

Typescript编译器突然开始产生错误

我正在开发一个Angular 2项目,当我尝试运行打字稿编译器时,突然间我开始出现大量的错误。 任何人都可以请build议从哪里开始search? 我没有明确地改变任何基本的东西,甚至当我从库中克隆一个新的副本,错误仍然存​​在。 错误如下: node_modules/@types/node/index.d.ts(102,6): error TS2300: Duplicate identifier 'BufferEncoding'. node_modules/@types/node/index.d.ts(256,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'errno' must be of type 'number', but here has type 'string'. node_modules/@types/node/index.d.ts(263,18): error TS2300: Duplicate identifier 'EventEmitter'. node_modules/@types/node/index.d.ts(549,26): error TS2300: Duplicate identifier 'Buffer'. node_modules/@types/node/index.d.ts(549,50): error TS2300: Duplicate identifier 'SlowBuffer'. node_modules/@types/node/index.d.ts(570,18): error TS2300: […]

在Angular 2应用程序中无法更改lite-server的基础文件夹

我正在经历Angular 2的5分钟快速入门 。 但是,我的应用程序驻留在src/文件夹中,而不是存储在我的存储库的根目录下,当我运行npm start ,应用程序正试图在根目录中find一个index.html文件。 我读了文件lite-server和文档显示,它使用BrowserSync和我可以重新configurationBrowserSync与我的库中的bs-config.json 。 我这样做,这是我的configuration看起来像: { "port": 8123, "server": { "baseDir": "./src" } } 根据日志,它使用指定的configuration: [1] > todo-app-angular2@1.0.0 lite E:\GitHub\todo-app-angular2 [1] > lite-server "./bs-config.json" 我也尝试了通过bs-config.js覆盖 module.exports = { port: 8123, server: { baseDir: "./src" } }; 然而,Angular应用程序仍然在端口3000上打开,而忽略了configuration中定义的baseDir。 我究竟做错了什么?

angular2 quickstart npm安装失败

当我尝试运行-npm install时出现以下错误。 错误如下: npm ERR! node v0.12.12 npm ERR! npm v3.3.6 npm ERR! code ELIFECYCLE npm ERR! angular2-quickstart@1.0.0 postinstall: `typings install` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the angular2-quickstart@1.0.0 postinstall script 'typings ins tall'. npm ERR! This is most likely a problem with the angular2-quickstart package, npm ERR! not with […]

npm ERR! 代码EPERM

我使用节点v6.11.2,npm v5.3.0和angular / cli v1.2.7。 我突然收到以下错误消息为我的npm安装的大多数。 以前从未见过… mmeppiel@MC-LT-MMEPPIEL MINGW64 ~/Desktop/Angular Solutions/my-app (master) $ npm install –save bootstrap@4.0.0-alpha.6 font-awesome npm ERR! path C:\Users\mmeppiel\Desktop\Angular Solutions\my-app\node_modules\fs events\node_modules npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall lstat npm ERR! Error: EPERM: operation not permitted, lstat 'C:\Users\mmeppiel\Desktop \Angular Solutions\my-app\node_modules\fsevents\node_modules' npm ERR! at Error (native) npm ERR! { […]

Angular 2快速启动ENOSPC错误

我正在尝试关于angularScript 2的官方5 Min Quickstart 。 我遵循所有步骤,当我运行npm start它popup我的Firefox浏览器上预期的My First Angular 2 App消息。 但是,当我检查控制台,我发现错误消息: Error: watch node_modules/angular2/es6/dev/src/common/directives/ng_if.js ENOSPC 我不知道它是否与我之前在项目的根文件夹上运行npm install时收到的警告消息相关: npm WARN install Couldn't install optional dependency: Unsupported npm WARN EPACKAGEJSON angular2-quickstart@1.0.0 No description npm WARN EPACKAGEJSON angular2-quickstart@1.0.0 No repository field. 有人能告诉我我的方法有什么问题吗? 更详细的控制台输出如下所示: > angular2-quickstart@1.0.0 start /home/ubuntu/jsProjects/angular2-quickstart > concurrent "npm run tsc:w" "npm run lite" [0] [0] […]

错误:无法find模块'webpack / lib / node / NodeTemplatePlugin'

运行webpack后得到这个错误。 Webpack是全球安装,我正在运行节点 PS D:\Projects\ng2-admin-master> ng serve Cannot find module 'webpack/lib/node/NodeTemplatePlugin' Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object.<anonymous> (D:\Projects\ng2-admin-master\node_modules\html-webpack-plugin\lib\compiler.js:11:26) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object.<anonymous> (D:\Projects\ng2-admin-master\node_modules\html-webpack-plugin\index.js:7:21) at […]

npm后安装types无法正常工作

我有以下packages.json: { "name": "shopping-assistant-angular", "version": "1.0.0", "scripts": { "start": "concurrent \"npm run tsc:w\" \"npm run lite\" ", "tsc": "tsc", "tsc:w": "tsc -w", "lite": "lite-server", "typings": "typings", "postinstall": "typings install" }, "license": "ISC", "dependencies": { "angular2": "2.0.0-beta.7", "systemjs": "0.19.23", "es6-promise": "^3.0.2", "es6-shim": "^0.33.3", "reflect-metadata": "0.1.2", "rxjs": "5.0.0-beta.2", "zone.js": "0.5.14" }, "devDependencies": { "bower": "^1.7.7", "concurrently": "^1.0.0", […]

npm start不会打开浏览器选项卡

我正在学习angularjs 2.我想在我的第一个应用程序在angularjs 2从他们的官方网站。所以我从这里跟随所有从https://angular.io/guide/quickstart 。 现在在第6步,我必须在terminal运行一个命令'npm start',它给了我terminal上的结果 – $ npm start > angular-quickstart@1.0.0 start D:\Sadiq\Res\Angularjs__2\angularQ > tsc && concurrently "tsc -w" "lite-server" [1] Did not detect a `bs-config.json` or `bs-config.js` override file. Using lite-server defaults… [1] ** browser-sync config ** [1] { injectChanges: false, [1] files: [ './**/*.{html,htm,css,js}' ], [1] watchOptions: { ignored: 'node_modules' }, [1] […]

发布操作不适用于Angular 4

我正在使用angular 4来学习node.js。我为简单的get / post请求构build了一个样本节点api。 我的get操作工作正常,我能够angular度获取数据。 我的后期操作没有得到任何angular度调用。 如果我使用POSTMAN,我可以成功地调用发布,数据也可以插入到数据库中。 这是我的节点发布示例代码 app.post('/groups', function (req, res, next){ res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type"); res.header("Access-Control-Allow-Methods", "GET, POST","PUT"); console.log('Request received with body' + req.body); //DEV AWS MySQL var mysql = require('mysql'); var connection = mysql.createConnection({ host : 'xxxxxxx', user : 'xxxxxxx', password : 'xxxxxxx', database : 'xxxxxxx', port : 3306 }); connection.connect(); […]