繁体   English   中英

无法为angular 2应用程式执行npm测试

[英]unable to run npm test for angular 2 app

我正在使用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

更改了Node和npm版本,并为我工作,运行了5.9.1和npm 3.8.6版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM