Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
启动项目时获取Angular 2中的错误_Angular_Npm - Fatal编程技术网

启动项目时获取Angular 2中的错误

启动项目时获取Angular 2中的错误,angular,npm,Angular,Npm,我是新来的。我已经设置了我的项目,并试图通过npm启动它,以前它工作正常,然后在我启动它的几天后,它在命令提示符中给出以下错误 SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:374:25) at Object.Module._extensions..js (module.js:417:10) at Module.load (module

我是新来的。我已经设置了我的项目,并试图通过npm启动它,以前它工作正常,然后在我启动它的几天后,它在命令提示符中给出以下错误

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/ahmer/practice/gmail-angular2/node_modules/@ngtools/webpack/src/index.js:5:10)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/ahmer/practice/gmail-angular2/node_modules/angular-cli/models/webpack-build-typescript.js:3:17)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/ahmer/practice/gmail-angular2/node_modules/angular-cli/models/webpack-config.js:2:34)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/ahmer/practice/gmail-angular2/node_modules/angular-cli/tasks/build-webpack.js:6:24)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/ahmer/practice/gmail-angular2/node_modules/angular-cli/commands/build.js:4:23)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Class.module.exports.includedCommands (/home/ahmer/practice/gmail-angular2/node_modules/angular-cli/addon/index.js:21:16)
at /home/ahmer/practice/gmail-angular2/node_modules/angular-cli/ember-cli/lib/models/project.js:335:61
at Array.forEach (native)
at Project.addonCommands (/home/ahmer/practice/gmail-angular2/node_modules/angular-cli/ember-cli/lib/models/project.js:334:15)
at Project.eachAddonCommand (/home/ahmer/practice/gmail-angular2/node_modules/angular-cli/ember-cli/lib/models/project.js:369:30)
at module.exports (/home/ahmer/practice/gmail-angular2/node_modules/angular-cli/ember-cli/lib/cli/lookup-command.js:33:13)
at CLI.<anonymous> (/home/ahmer/practice/gmail-angular2/node_modules/angular-cli/ember-cli/lib/cli/cli.js:43:26)
at tryCatch (/home/ahmer/practice/gmail-angular2/node_modules/rsvp/dist/rsvp.js:538:12)
at invokeCallback (/home/ahmer/practice/gmail-angular2/node_modules/rsvp/dist/rsvp.js:553:13)
at publish (/home/ahmer/practice/gmail-angular2/node_modules/rsvp/dist/rsvp.js:521:7)
at flush (/home/ahmer/practice/gmail-angular2/node_modules/rsvp/dist/rsvp.js:2373:5)
at nextTickCallbackWith0Args (node.js:419:9)
at process._tickCallback (node.js:348:13)
SyntaxError:意外标记{
在exports.runInThisContext(vm.js:53:16)
在模块处编译(Module.js:374:25)
在Object.Module.\u extensions..js(Module.js:417:10)
在Module.load(Module.js:344:32)
在Function.Module.\u加载(Module.js:301:12)
at Module.require(Module.js:354:17)
根据需要(内部/module.js:12:17)
在对象上。(/home/ahmer/practice/gmail-angular2/node_modules/@ngtools/webpack/src/index.js:5:10)
在模块处编译(Module.js:410:26)
在Object.Module.\u extensions..js(Module.js:417:10)
在Module.load(Module.js:344:32)
在Function.Module.\u加载(Module.js:301:12)
at Module.require(Module.js:354:17)
根据需要(内部/module.js:12:17)
在对象上。(/home/ahmer/practice/gmail-angular2/node_modules/angular cli/models/webpack build typescript.js:3:17)
在模块处编译(Module.js:410:26)
在Object.Module.\u extensions..js(Module.js:417:10)
在Module.load(Module.js:344:32)
在Function.Module.\u加载(Module.js:301:12)
at Module.require(Module.js:354:17)
根据需要(内部/module.js:12:17)
在对象上。(/home/ahmer/practice/gmail-angular2/node_modules/angular cli/models/webpack config.js:2:34)
在模块处编译(Module.js:410:26)
在Object.Module.\u extensions..js(Module.js:417:10)
在Module.load(Module.js:344:32)
在Function.Module.\u加载(Module.js:301:12)
at Module.require(Module.js:354:17)
根据需要(内部/module.js:12:17)
在对象上。(/home/ahmer/practice/gmail-angular2/node_modules/angular cli/tasks/build webpack.js:6:24)
在模块处编译(Module.js:410:26)
在Object.Module.\u extensions..js(Module.js:417:10)
在Module.load(Module.js:344:32)
在Function.Module.\u加载(Module.js:301:12)
at Module.require(Module.js:354:17)
根据需要(内部/module.js:12:17)
在对象上。(/home/ahmer/practice/gmail-angular2/node_modules/angular cli/commands/build.js:4:23)
在模块处编译(Module.js:410:26)
在Object.Module.\u extensions..js(Module.js:417:10)
在Module.load(Module.js:344:32)
在Function.Module.\u加载(Module.js:301:12)
at Module.require(Module.js:354:17)
根据需要(内部/module.js:12:17)
在Class.module.exports.includedCommands(/home/ahmer/practice/gmail-angular2/node_modules/angular cli/addon/index.js:21:16)
at/home/ahmer/practice/gmail-angular2/node_modules/angular cli/ember cli/lib/models/project.js:335:61
at Array.forEach(本机)
在Project.addonCommand(/home/ahmer/practice/gmail-angular2/node_modules/angular cli/ember cli/lib/models/Project.js:334:15)
在Project.eachaddon命令(/home/ahmer/practice/gmail-angular2/node_modules/angular cli/ember cli/lib/models/Project.js:369:30)
在module.exports(/home/ahmer/practice/gmail-angular2/node_modules/angular cli/ember cli/lib/cli/lookup command.js:33:13)
在CLI上。(/home/ahmer/practice/gmail-angular2/node_modules/angular CLI/ember CLI/lib/CLI/CLI.js:43:26)
在tryCatch(/home/ahmer/practice/gmail-angular2/node_modules/rsvp/dist/rsvp.js:538:12)
在invokeCallback(/home/ahmer/practice/gmail-angular2/node_modules/rsvp/dist/rsvp.js:553:13)
发布时(/home/ahmer/practice/gmail-angular2/node_modules/rsvp/dist/rsvp.js:521:7)
齐平(/home/ahmer/practice/gmail-angular2/node_modules/rsvp/dist/rsvp.js:2373:5)
在下一个TTickCallbackwith0args(node.js:419:9)
在进程中调用(node.js:348:13)

你知道如何解决这个问题吗?

我相信你已经用稍旧的angular CLI版本创建了你的项目。 在我将angular cli版本更新为最新版本后,我自己也出现了相同的错误。angular cli是在不久前更新的,因此它需要节点版本6.9.0或更高版本以及npm版本3或更高版本。


tldr:您必须更新节点版本

将代码复制到此处更新您的package.json到post@Kuncevic哪种代码?@Aravind如何转换为post?请尝试npm安装