Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module '@angular/core/testing' #174

Closed
wuesam opened this issue Nov 15, 2016 · 12 comments
Closed

Cannot find module '@angular/core/testing' #174

wuesam opened this issue Nov 15, 2016 · 12 comments

Comments

@wuesam
Copy link

wuesam commented Nov 15, 2016

I wanted to get started with unittesting my Ionic2 application and followed the instructions provided, but when I create my first unit test I get the following Errors:

  •      Cannot find module '@angular/core/testing'
    
  •      C:\Workspace\....\test is not a module
    

And when I start „npm test“ I get the following error:

  •      Cannot find module 'reflect-metadata'
    

I would appreciate any help on what is going wrong here

@lathonez
Copy link
Owner

Are you able to install and test this repo without any issues?

On 15 Nov 2016 20:57, "samoncode" notifications@github.com wrote:

I wanted to get started with unittesting my Ionic2 application and
followed the instructions provided, but when I create my first unit test I
get the following Errors:

    Cannot find module '@angular/core/testing'
    C:\Workspace\....\test is not a module

And when I start „npm test“ I get the following error:

    Cannot find module 'reflect-metadata'

I would appreciate any help on what is going wrong here


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#174, or mute the thread
https://github.com/notifications/unsubscribe-auth/AG5tSPCJfzPs-BO4f1X6BqfCLp81fMPIks5q-YIlgaJpZM4KyVM5
.

@aeremin
Copy link

aeremin commented Nov 15, 2016

Point of data: I have cloned this repo yesterday, npm test worked for me, but I still got warnings about "Cannot find module '@angular/core/testing'" in Visual Studio Code. I am using latest Node.js (6.9.1).

@lathonez
Copy link
Owner

@samoncode can you paste the actual output of npm test please? I'm not interested in Visual Studio errors (if that is what those first ones are).

@lathonez
Copy link
Owner

Also please confirm whether or not you are able to clone and test this repo.

We have no references to reflect-metadata anywhere in the project.

@wuesam
Copy link
Author

wuesam commented Nov 16, 2016

@lathonez the first mentioned errors come from Visual Studio Code.
If I run "npm test" on this repo I get the following output

D:\Workspace\ionic2\clicker-master\clicker-master>npm test

> Clicker@2.2.0 test D:\Workspace\ionic2\clicker-master\clicker-master
> ng test

D:\Workspace\ionic2\clicker-master\clicker-master\node_modules\angular-cli\bin\ng:7
const resolve = require('resolve');
^^^^^
SyntaxError: Use of const in strict mode.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3
npm ERR! Test failed.  See above for more details.

"ionic serve" does not work for me here. Is this the expected behaviour?

`

D:\Workspace\ionic2\clicker-master\clicker-master>ionic serve

Running 'serve:before' npm script before serve

> Clicker@2.2.0 watch D:\Workspace\ionic2\clicker-master\clicker-master
> ionic-app-scripts watch

[01:55:48]  ionic-app-scripts 0.0.39
[01:55:48]  watch started ...
[01:55:48]  build dev started ...
[01:55:48]  clean started ...
[01:55:48]  clean finished in 14 ms
[01:55:48]  copy started ...
[01:55:48]  transpile started ...
[01:55:49]  lint started ...
[01:55:55]  lint finished in 5.99 s
[01:55:55]  transpile finished in 7.21 s
[01:55:55]  webpack started ...
[01:55:55]  copy finished in 7.44 s
                                                                                         [01:56:05]  webpack finished in 9.35 s
[01:56:05]  sass started ...
[01:56:08]  sass finished in 3.35 s
[01:56:08]  build dev finished in 19.95 s
[01:56:08]  ionic-app-script task: "watch"
[01:56:08]  SyntaxError:
            D:\Workspace\ionic2\clicker-master\clicker-master\node_modules\@ionic\app-scripts\config\watch.config.js:41
            paths: copyConfig.map(f => f.src), ^^ Unexpected token =>

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.4
npm ERR! code ELIFECYCLE
npm ERR! Clicker@2.2.0 watch: `ionic-app-scripts watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Clicker@2.2.0 watch script 'ionic-app-scripts watch'.
npm ERR! This is most likely a problem with the Clicker package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts watch
npm ERR! You can get their info via:
npm ERR!     npm owner ls Clicker
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Workspace\ionic2\clicker-master\clicker-master\npm-debug.log
`

@lathonez
Copy link
Owner

Are you able to follow the Ionic tutorial?

http://ionicframework.com/docs/v2/getting-started/tutorial/

ionic start MyIonic2Project tutorial --v2

cd MyIonic2Project

ionic serve

If not please raise with Ionic.

@wuesam
Copy link
Author

wuesam commented Nov 16, 2016

I indeed had a problem in general. Had to update node. And now the project here works for me! Great!
But I am on another computer at the moment, have to see what the problem in the other project was about..

@wuesam
Copy link
Author

wuesam commented Nov 17, 2016

Ok, for me it is the same now as for aeremin. The test are working! Only VS-Code does not find the testing module.

@lathonez
Copy link
Owner

Removing this line solves it:

https://github.com/lathonez/clicker/blob/master/tsconfig.json#L22

Not a complete solution however:

#159

@lathonez
Copy link
Owner

Annoyingly enough I can't replicate 159 as I don't have windows.

@lathonez
Copy link
Owner

0ae024b

@sameerparab355
Copy link

getting the same error , using node - 6.11.11 and npm 3.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants