我在堆栈溢出时尝试了所有现有解决方案,但是没有一个在起作用。
node js version -> v8.11.3
npm versin -> 5.6.0:
Windows 8:
我的目标:基本上,我正在尝试使用此链接将angular 5应用程序转换为通用应用程序(用于SEO)
运行ng build
命令后,我输入了命令node dist/server.js
,并出现以下错误:
C:\Y_ntt\Try-Angular-v4-master>node dist/server.js
module.js:549
throw err;
^
Error: Cannot find module 'C:\Y_ntt\Try-Angular-v4-master\dist\server.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
我的dist文件夹内容:
除了命令node dist/server.js
之外,我还尝试了以下命令,但是它们都不起作用:
node server.js
node dist/server.js
如果尝试运行此命令node dist/server/main.js
,则出现以下错误:
C:\Y_ntt\Try-Angular-v4-master>node dist/server/main.js
C:\Y_ntt\Try-Angular-v4-master\node_modules\ngx-bootstrap\carousel\carousel.component.js:14
import { Component, Input, Output, EventEmitter, NgZone } from '@angular/core';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.ngx-bootstrap/carousel/carousel.component (C:\Y_ntt\Try-Angular-v4-master\dist\server\main.js:2765:18)
请帮助我,我将不胜感激!