lathonez / clicker

Ionic 2 + @angular/cli Seed Project : Angular2 + Typescript + Karma + Protractor + Travis
http://lathonez.com/2018/ionic-2-unit-testing/
MIT License
430 stars 136 forks source link

Unable to compile TypeScript #85

Closed juliocbcotta closed 8 years ago

juliocbcotta commented 8 years ago

Hello lathonez, could you try help me? I updated my project to yours latest configs, but my npm test gives me:

 Requiring external module ts-node/register
TSError: ⨯ Unable to compile TypeScript
test/gulpfile.ts (2,31): Cannot find module 'path'. (2307)
test/gulpfile.ts (3,31): Cannot find module 'del'. (2307)
test/gulpfile.ts (4,31): Cannot find module 'fs'. (2307)
test/gulpfile.ts (5,31): Cannot find module 'glob'. (2307)
test/gulpfile.ts (6,31): Cannot find module 'gulp'. (2307)
test/gulpfile.ts (7,31): Cannot find module 'istanbul'. (2307)
test/gulpfile.ts (8,31): Cannot find module 'karma'. (2307)
test/gulpfile.ts (9,31): Cannot find module 'gulp-load-plugins'. (2307)
test/gulpfile.ts (10,31): Cannot find module 'run-sequence'. (2307)
test/gulpfile.ts (16,13): Cannot find name 'require'. (2304)
test/gulpfile.ts (16,26): Cannot find name 'process'. (2304)
test/gulpfile.ts (17,50): Cannot find name 'process'. (2304)
test/gulpfile.ts (50,25): Cannot find name 'require'. (2304)
test/gulpfile.ts (85,24): Cannot find name 'process'. (2304)
test/gulpfile.ts (97,24): Cannot find name 'process'. (2304)
test/gulpfile.ts (146,32): Property 'find' does not exist on type 'string[]'. (2339)
test/gulpfile.ts (159,28): Cannot find name 'require'. (2304)
    at getOutput (/home/julio/git/platypus/node_modules/ts-node/src/ts-node.ts:209:13)
    at Object.loader (/home/julio/git/platypus/node_modules/ts-node/src/ts-node.ts:224:23)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Liftoff.handleArguments (/home/julio/git/platypus/node_modules/gulp/bin/gulp.js:116:3)
    at Liftoff.<anonymous> (/home/julio/git/platypus/node_modules/liftoff/index.js:193:16)
    at module.exports (/home/julio/git/platypus/node_modules/flagged-respawn/index.js:17:3)
    at Liftoff.<anonymous> (/home/julio/git/platypus/node_modules/liftoff/index.js:185:9)
npm ERR! Test failed.  See above for more details.

I already removed node_modules/ and typings/, but still can't make it work. Would you have any tips to solve it?

PS: Clicker project works just fine.

tja4472 commented 8 years ago

When I updated my project i did the following.

Update project from clicker

mbakker96 commented 8 years ago

Did you do 'npm install'

juliocbcotta commented 8 years ago

Yes, I did. I copied test folder, I updated package.json and typings.json, I ran npm install (which runs typings install)

lathonez commented 8 years ago

Yeah the typings are missing.

If you clone the project new and run npm install do you get the same behaviour?

this is the important line, though obviously it depends what you've got in typings.

juliocbcotta commented 8 years ago

Even after I ran typings install I have the same errror.

My typings.json

{
  "ambientDependencies": {
    "cordova-plugin-email-composer": "registry:dt/cordova-plugin-email-composer#0.0.0+20160316155526",
    "cordova/plugins/filesystem": "registry:dt/cordova/plugins/filesystem#0.0.0+20160316155526",
    "cordova/plugins/filetransfer": "registry:dt/cordova/plugins/filetransfer#0.0.0+20160329171220",
    "cordova/plugins/splashscreen": "registry:dt/cordova/plugins/splashscreen#0.0.0+20160316155526",
    "angular-protractor": "registry:dt/angular-protractor#1.5.0+20160317120654",
    "bluebird": "registry:dt/bluebird#2.0.0+20160319051630",
    "chalk": "registry:dt/chalk#0.4.0+20160317120654",
    "del": "registry:dt/del#2.2.0+20160317120654",
    "es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
    "express": "registry:dt/express#4.0.0+20160317120654",
    "express-serve-static-core": "registry:dt/express-serve-static-core#0.0.0+20160322035842",
    "glob": "registry:dt/glob#5.0.10+20160317120654",
    "gulp": "registry:dt/gulp#3.8.0+20160316155526",
    "gulp-load-plugins": "registry:dt/gulp-load-plugins#0.0.0+20160316155526",
    "gulp-typescript": "registry:dt/gulp-typescript#0.0.0+20160317120654",
    "gulp-util": "registry:dt/gulp-util#3.0.0+20141016163602",
    "istanbul": "registry:dt/istanbul#0.4.0+20160316155526",
    "jasmine": "registry:dt/jasmine#2.2.0+20160412134438",
    "karma": "registry:dt/karma#0.13.9+20160316155526",
    "log4js": "registry:dt/log4js#0.0.0+20160316155526",
    "mime": "registry:dt/mime#0.0.0+20160316155526",
    "minimatch": "registry:dt/minimatch#2.0.8+20160317120654",
    "node": "registry:dt/node#4.0.0+20160412142033",
    "orchestrator": "registry:dt/orchestrator#0.0.0+20160316155526",
    "q": "registry:dt/q#0.0.0+20160323171452",
    "run-sequence": "registry:dt/run-sequence#0.0.0+20160316155526",
    "selenium-webdriver": "registry:dt/selenium-webdriver#2.44.0+20160317120654",
    "serve-static": "registry:dt/serve-static#1.7.1+20160104095738",
    "through2": "registry:dt/through2#2.0.0+20160317120654",
    "vinyl": "registry:dt/vinyl#1.1.0+20160316155526"
  }
}

The clicker project works just fine.

lathonez commented 8 years ago

Ah

PS: Clicker project works just fine.

I'll take that as a "yes" to cloning from new.

If you haven't already tried it remove node_modules and typings folders before running npm install.

x220:~/code/clicker$ cat typings/main.d.ts 
/// <reference path="main/ambient/angular-protractor/index.d.ts" />
/// <reference path="main/ambient/bluebird/index.d.ts" />
/// <reference path="main/ambient/chalk/index.d.ts" />
/// <reference path="main/ambient/del/index.d.ts" />
/// <reference path="main/ambient/es6-shim/index.d.ts" />
/// <reference path="main/ambient/express-serve-static-core/index.d.ts" />
/// <reference path="main/ambient/express/index.d.ts" />
/// <reference path="main/ambient/glob/index.d.ts" />
/// <reference path="main/ambient/gulp-load-plugins/index.d.ts" />
/// <reference path="main/ambient/gulp-typescript/index.d.ts" />
/// <reference path="main/ambient/gulp-util/index.d.ts" />
/// <reference path="main/ambient/gulp/index.d.ts" />
/// <reference path="main/ambient/istanbul/index.d.ts" />
/// <reference path="main/ambient/jasmine/index.d.ts" />
/// <reference path="main/ambient/karma/index.d.ts" />
/// <reference path="main/ambient/log4js/index.d.ts" />
/// <reference path="main/ambient/mime/index.d.ts" />
/// <reference path="main/ambient/minimatch/index.d.ts" />
/// <reference path="main/ambient/moment-node/index.d.ts" />
/// <reference path="main/ambient/moment/index.d.ts" />
/// <reference path="main/ambient/node/index.d.ts" />
/// <reference path="main/ambient/orchestrator/index.d.ts" />
/// <reference path="main/ambient/q/index.d.ts" />
/// <reference path="main/ambient/run-sequence/index.d.ts" />
/// <reference path="main/ambient/selenium-webdriver/index.d.ts" />
/// <reference path="main/ambient/serve-static/index.d.ts" />
/// <reference path="main/ambient/through2/index.d.ts" />
/// <reference path="main/ambient/vinyl/index.d.ts" />

Do you get the same output?

juliocbcotta commented 8 years ago

My typings are different... I don't have

/// <reference path="main/ambient/moment-node/index.d.ts" />
/// <reference path="main/ambient/moment/index.d.ts" />

and I have

/// <reference path="main/ambient/cordova-plugin-email-composer/index.d.ts" />
/// <reference path="main/ambient/cordova/plugins/filesystem/index.d.ts" />
/// <reference path="main/ambient/cordova/plugins/filetransfer/index.d.ts" />
/// <reference path="main/ambient/cordova/plugins/splashscreen/index.d.ts" />

full typings/main.d.ts

cat typings/main.d.ts                                                                                                                                                                                                                                                 1 ↵
/// <reference path="main/ambient/angular-protractor/index.d.ts" />
/// <reference path="main/ambient/bluebird/index.d.ts" />
/// <reference path="main/ambient/chalk/index.d.ts" />
/// <reference path="main/ambient/cordova-plugin-email-composer/index.d.ts" />
/// <reference path="main/ambient/cordova/plugins/filesystem/index.d.ts" />
/// <reference path="main/ambient/cordova/plugins/filetransfer/index.d.ts" />
/// <reference path="main/ambient/cordova/plugins/splashscreen/index.d.ts" />
/// <reference path="main/ambient/del/index.d.ts" />
/// <reference path="main/ambient/es6-shim/index.d.ts" />
/// <reference path="main/ambient/express-serve-static-core/index.d.ts" />
/// <reference path="main/ambient/express/index.d.ts" />
/// <reference path="main/ambient/glob/index.d.ts" />
/// <reference path="main/ambient/gulp-load-plugins/index.d.ts" />
/// <reference path="main/ambient/gulp-typescript/index.d.ts" />
/// <reference path="main/ambient/gulp-util/index.d.ts" />
/// <reference path="main/ambient/gulp/index.d.ts" />
/// <reference path="main/ambient/istanbul/index.d.ts" />
/// <reference path="main/ambient/jasmine/index.d.ts" />
/// <reference path="main/ambient/karma/index.d.ts" />
/// <reference path="main/ambient/log4js/index.d.ts" />
/// <reference path="main/ambient/mime/index.d.ts" />
/// <reference path="main/ambient/minimatch/index.d.ts" />
/// <reference path="main/ambient/node/index.d.ts" />
/// <reference path="main/ambient/orchestrator/index.d.ts" />
/// <reference path="main/ambient/q/index.d.ts" />
/// <reference path="main/ambient/run-sequence/index.d.ts" />
/// <reference path="main/ambient/selenium-webdriver/index.d.ts" />
/// <reference path="main/ambient/serve-static/index.d.ts" />
/// <reference path="main/ambient/through2/index.d.ts" />
/// <reference path="main/ambient/vinyl/index.d.ts" />
lathonez commented 8 years ago

Looks legit. If you can chat on gitter it might be easier

lathonez commented 8 years ago

The main issue here was the line

files: [] in tsconfig.json