【发布时间】:2017-07-12 06:17:57
【问题描述】:
我正在使用一个 angular 2 应用程序,我对它很陌生,我已经使用 cordova 应用程序设置它并通过 npm 运行它,应用程序启动时没有错误并且运行顺利,但是当我尝试运行时使用节点的测试(即 npm 测试),它给出以下错误
D:\VisionEngage\VisionEngage>npm test
> VisionEngage@1.0.0 test D:\VisionEngage\VisionEngage
> ng test
As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
which will only support Node 6.9 and greater. This package will be officially deprecated
shortly after.
To disable this warning use "ng set --global warnings.packageDeprecation=false".
You have to be inside an angular-cli project in order to use the test command.
npm ERR! Test failed. See above for more details.
我也尝试安装 @angular/cli(即 npm install @angular/cli),但之后出现以下错误
D:\VisionEngage\VisionEngage>npm test
> VisionEngage@1.0.0 test D:\VisionEngage\VisionEngage
> ng test
12 07 2017 09:54:39.829:ERROR [config]: Error in config file!
Error: Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "undefined".
at Object.<anonymous> (D:\VisionEngage\VisionEngage\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> (D:\VisionEngage\VisionEngage\node_modules\angular-cli\models\webpack-configs\test.js:5: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)
npm ERR! Test failed. See above for more details.
正如它所说,@angular/compiler-cli 的版本需要 2.3.1 或更高版本才能运行此操作,然后我尝试通过 npm 安装相同的版本(即 npm install @angular/compiler-cli@2.3. 1)但它没有成功,因为它有一些未满足的依赖关系,此操作的错误如下
D:\VisionEngage\VisionEngage>npm install @angular/compiler-cli@2.3.1
VisionEngage@1.0.0 D:\VisionEngage\VisionEngage
+-- UNMET PEER DEPENDENCY @angular/compiler@2.2.1 invalid
+-- UNMET PEER DEPENDENCY @angular/compiler-cli@2.3.1 invalid
| `-- @angular/tsc-wrapped@0.5.0
| `-- tsickle@0.2.6
| +-- source-map@0.5.6
| `-- source-map-support@0.4.15
| `-- source-map@0.5.6
`-- UNMET PEER DEPENDENCY @angular/core@2.2.1 invalid
我尝试通过安装/更新所有这些依赖项来解决此问题,但无法解决。也许我' 我做错了什么或缺少某些东西,我们将不胜感激。
Environment: Windows 10 (64 bit)
Node version : 6.11.0
Npm version: 3.10.10
【问题讨论】:
标签: javascript angularjs node.js cordova