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 137 forks source link

No such file or directory error #232

Closed varunxyz closed 7 years ago

varunxyz commented 7 years ago

Hi,

I've just set up a basic Ionic2 app, and followed the instructions specified in the blog. When I run npm test I end up with the following error. Tried debugging it but no luck :(

`Module build failed: TypeError: Cannot read property 'newLine' of undefined
    at Object.getNewLineCharacter (/Users/varunpasad/projects/apps/driver/node_modules/typescript/lib/typescript.js:80
62:20)
    at Object.createCompilerHost (/Users/varunpasad/projects/apps/driver/node_modules/typescript/lib/typescript.js:449
78:26)
    at Object.ngcLoader (/Users/varunpasad/projects/apps/driver/node_modules/@ngtools/webpack/src/loader.js:338:33)
 @ multi ./src/polyfills.ts

ERROR in ./src/test.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
    at Object.getNewLineCharacter (/Users/varunpasad/projects/apps/driver/node_modules/typescript/lib/typescript.js:80
62:20)
    at Object.createCompilerHost (/Users/varunpasad/projects/apps/driver/node_modules/typescript/lib/typescript.js:449
78:26)
    at Object.ngcLoader (/Users/varunpasad/projects/apps/driver/node_modules/@ngtools/webpack/src/loader.js:338:33)
05 03 2017 01:00:21.836:ERROR [karma]: { Error
    at MemoryFileSystem.readFileSync (/Users/varunpasad/projects/apps/driver/node_modules/memory-fs/lib/MemoryFileSyst
em.js:107:10)
    at MemoryFileSystem.(anonymous function) [as readFile] (/Users/varunpasad/projects/apps/driver/node_modules/memory
-fs/lib/MemoryFileSystem.js:300:34)
    at doRead (/Users/varunpasad/projects/apps/driver/node_modules/@angular/cli/node_modules/karma-webpack/lib/karma-w
ebpack.js:205:29)
    at Plugin.readFile (/Users/varunpasad/projects/apps/driver/node_modules/@angular/cli/node_modules/karma-webpack/li
b/karma-webpack.js:210:7)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
  code: 'ENOENT',
  errno: 34,
  message: 'no such file or directory',
  path: '/_karma_webpack_/src/polyfills.ts' }
05 03 2017 01:00:21.844:ERROR [karma]: { Error
    at MemoryFileSystem.readFileSync (/Users/varunpasad/projects/apps/driver/node_modules/memory-fs/lib/MemoryFileSystem.js:107:10)
    at MemoryFileSystem.(anonymous function) [as readFile] (/Users/varunpasad/projects/apps/driver/node_modules/memory-fs/lib/MemoryFileSystem.js:300:34)
    at doRead (/Users/varunpasad/projects/apps/driver/node_modules/@angular/cli/node_modules/karma-webpack/lib/karma-webpack.js:205:29)
    at Plugin.readFile (/Users/varunpasad/projects/apps/driver/node_modules/@angular/cli/node_modules/karma-webpack/lib/karma-webpack.js:210:7)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
  code: 'ENOENT',
  errno: 34,
  message: 'no such file or directory',
  path: '/_karma_webpack_/src/test.ts' }
npm ERR! Test failed.  See above for more details.`

Also attaching package.json for reference package.txt

Thanks

lathonez commented 7 years ago

Hey,

I was getting these errors before upgrading to angular 2.4, but I see you have those in your package.json. I have compared your package.json with ours, and it looks fine.

There may be some other difference in your project, there are a load of files that need changing.

My advice:

If you can provide me a link to clone your project I am happy to take a look.

Steve

Naxo commented 7 years ago

Hello all,

I had the same problem last week. I don't understand the error, but I relaunched npm test again before the error appeared and now it works properly.

varunxyz, I followed the steps that lathonez says. Try again and executing npm test, after you have finished steps. If it doesn't work, restart your terminal or system.

Maybe that something is cached and it is being executed old code or similar.​

Nacho

lathonez commented 7 years ago

Assume this is resolved, please reopen if not

varunxyz commented 7 years ago

Sorry for the delay!

Thanks doing a clean and installation fixed my issue :)