Ric*_*Liu 13 node.js travis-ci typescript protractor angular
我正面临着这个问题:
我的项目是建立在Angular4上的打字稿,e2e测试与量角器和业力.
Travis-ci有这个错误:
[03:34:54] E/launcher - Error: TSError: ? Unable to compile TypeScript
Cannot find type definition file for 'jasmine'. (2688)
Cannot find type definition file for 'node'. (2688)
e2e/app.e2e-spec.ts (1,32): Cannot find module './app.po'. (2307)
e2e/app.e2e-spec.ts (4,1): Cannot find name 'describe'. (2304)
e2e/app.e2e-spec.ts (7,3): Cannot find name 'beforeEach'. (2304)
e2e/app.e2e-spec.ts (11,3): Cannot find name 'it'. (2304)
e2e/app.e2e-spec.ts (13,5): Cannot find name 'expect'. (2304)
The command "ng e2e" exited with 4.
Run Code Online (Sandbox Code Playgroud)
我的tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": ".",
"paths": {
"*": ["./node_modules/*", "*"]
},
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"types": [ "node", "jasmine" ],
"typeRoots": [
"./node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}
Run Code Online (Sandbox Code Playgroud)
我的tsconfig.spec.json:
{
"compilerOptions": {
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es2016",
"dom"
],
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es5",
"baseUrl": "",
"types": [
"jasmine",
"node"
],
"typeRoots": [
"../node_modules/@types"
]
},
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts"
]
}
Run Code Online (Sandbox Code Playgroud)
节点v6.10.3
npm v3.10.10
请帮我.
我遇到了同样的问题。首先,我从package.json中删除ts-node和typescript。然后,
npm install ts-node --save-dev
npm install typescript -g
npm install typescript --save-dev
Run Code Online (Sandbox Code Playgroud)
当我更新我的打字稿版本时,我来到这里寻找类似错误的解决方案,我的不是一个新项目,我正在使用"@angular/cli": "1.2.0"
. 我将我的打字稿版本从 更新到2.0.3
,2.7.2
然后在运行时遇到类似的问题,如下所示ng e2e
。
\n\n\n错误:TSError:\xe2\xa8\xaf 无法编译 TypeScript\n找不到 \'core-js\' 的类型定义文件。(2688)\n无法找到“grecaptcha”的类型定义文件。(2688)\n找不到“jasmine”的类型定义文件。(2688)\n找不到“时刻时区”的类型定义文件。(2688)\n找不到“节点”的类型定义文件。(2688)\n找不到 \'q\' 的类型定义文件。(2688)\n
这篇文章中提出的解决方案对我不起作用。
\n\nts-node
我通过更新到 来修复它5.0.1
。ng e2e
即使我已experimentalDecorators
设置为true
in ,上述版本在运行时也会出现如下错误tsconfig.json
:
\n\n\n错误 TS1219:对装饰器的实验性支持是一项功能,可能会在未来版本中发生更改。设置“experimentalDecorators”选项以删除此警告
\n
除了上述更改之外,我还更改了几行protractor.conf.js
改变:
\n\nbeforeLaunch: function () {\n require(\'ts-node\').register({\n project: \'e2e\'\n });\n},\n
Run Code Online (Sandbox Code Playgroud)\n\n到
\n\nbeforeLaunch: function () {\n require(\'ts-node/register\')\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n这是针对那些可能偶然发现这篇文章并且建议的解决方案对他们不起作用的人。
\n 归档时间: |
|
查看次数: |
15918 次 |
最近记录: |