当我运行npm时我得到了这个错误。怎么解决这个问题?

时间:2017-05-15 09:40:28

标签: angular

Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
Error: Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
    at Object.<anonymous> (H:\tables\node_modules\@ngtools\webpack\src\index.js:27:11)
    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> (H:\tables\node_modules\angular-cli\models\webpack-build-typescript.js:3:17)
    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> (H:\tables\node_modules\angular-cli\models\webpack-config.js:2:34)
    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> (H:\tables\node_modules\angular-cli\tasks\build-webpack.js:6:24)
    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> (H:\tables\node_modules\angular-cli\commands\build.js:3:23)
    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 Class.includedCommands (H:\tables\node_modules\angular-cli\addon\index.js:21:16)
    at H:\tables\node_modules\angular-cli\angular-cli\lib\models\project.js:392:61
    at Array.forEach (native)
    at Project.addonCommands (H:\tables\node_modules\angular-cli\angular-cli\lib\models\project.js:391:15)
    at Project.eachAddonCommand (H:\tables\node_modules\angular-cli\angular-cli\lib\models\project.js:426:30)
    at module.exports (H:\tables\node_modules\angular-cli\angular-cli\lib\cli\lookup-command.js:33:13)
    at CLI.<anonymous> (H:\tables\node_modules\angular-cli\angular-cli\lib\cli\cli.js:34:26)
    at tryCatch (H:\tables\node_modules\rsvp\dist\rsvp.js:539:12)
    at invokeCallback (H:\tables\node_modules\rsvp\dist\rsvp.js:554:13)
    at publish (H:\tables\node_modules\rsvp\dist\rsvp.js:522:7)
    at flush (H:\tables\node_modules\rsvp\dist\rsvp.js:2414:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! table-order@0.0.0 start: `ng serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the table-order@0.0.0 start script 'ng serve'.
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 table-order package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ng serve
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs table-order
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls table-order
npm ERR! There is likely additional logging output above.

2 个答案:

答案 0 :(得分:0)

@ angular / compiler-cli需要在angularjs中编译。检查你的package.json是否存在andgular-compile-cli。

在package.json所在的终端中运行以下注释

  

npm install

答案 1 :(得分:0)

尝试,

更新nodejs:

test operator in bash

彻底重新安装角度cli

observeSingleEvent()