Я попытался обновить npm, npm start then install, но ошибка кажется странной в начале загрузки самого приложения ,Когда я запускаю «npm start», я получаю «SyntaxError: Неожиданный импорт токена» в обычном проекте Angular 2
Как он не мог распознать «импорт», самое первое слово обычного стандартного загрузочного файла?
StackTrace является:
C:\Users\Andreas\Project>npm start
> [email protected] start C:\Users\Andreas\Project
> node ./app/main.ts
C:\Users\Andreas\Project\app\main.ts:1
(function (exports, require, module, __filename, __dirname) { import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
^^^^^^
SyntaxError: Unexpected token import
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
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.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node ./app/main.ts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node ./app/main.ts'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./app/main.ts
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Andreas\Project\npm-debug.log
C:\Users\Andreas\Project>npm start
> [email protected] start C:\Users\Andreas\Project
> node ./app/main.ts
C:\Users\Andreas\Project\app\main.ts:1
(function (exports, require, module, __filename, __dirname) { import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
^^^^^^
SyntaxError: Unexpected token import
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
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.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node ./app/main.ts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node ./app/main.ts'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./app/main.ts
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Andreas\Project\npm-debug.log
Вы пытаетесь запустить угловой файл main.ts, который должен быть передан в JavaScript, в комплекте, загружен браузером и выполнен браузером с узлом (который представляет собой среду выполнения JavaScript на стороне сервера). Это не имеет смысла. Где вы прочитали, что вам нужно выполнить эту команду? –
Чтобы запустить локальную версию отладки, вы запускаете «npm start» внутри своего проекта? Это должно запустить сервер? Я прочитал его здесь: https://angular.io/docs/ts/latest/guide/setup.html –
Вот как выглядит ваш файл package.json, если вы следуете инструкциям: https://github.com/angular /quickstart/blob/master/package.json. Наверное, это не похоже. –