cannot start server

I am following the steps (in https://malcoded.com/posts/angular-fundamentals-universal-server-side-rendering) to setup Angular Universe - I'm retrofitting it on top of an existing Angular 2 application. I am using node/npm on Windows.

After the setup is done, the server is started via the server.js code, submitted via:-

node server.js

server.js contains the line of code:-

require("./dist-server/main.bundle")

"./dist-server/main.bundle" contains the compiled 'server' output and fails with the message

C:Projectsxxxxnode_modules@ng-bootstrapng-bootstrapmodalmodal.js:1 (function (exports, require, module, __filename, __dirname) { import { Injectable, Injector, ComponentFactoryResolver } from '@angular/core'; ^^^^^^

SyntaxError: Unexpected token import ...

I have tried running via babel-node installed via the following

npm install babel-cli --save-dev
npm install babel-preset-env --save-dev
"node_modules/.bin/babel-node" --presets env server.js

By default the babel-node command above should ignore all files under node_modules (see https://leanpub.com/setting-up-es6/read - 4.3.4.1). However the above fails within a module under node_modules

Is there something I am doing wrong ?

链接地址: http://www.djcxy.com/p/31344.html

上一篇: cli生成并在共享服务器上上传

下一篇: 无法启动服务器