Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot read property 'getLineAndCharacterOfPosition' of undefined

Tags:

angular

I got stuck with this error, can someone help me out? I just upgraded to Angular2.4.3

$ ng serve                                                                                                                                                                              [19:46:01]
** NG Live Development Server is running on http://localhost:4200. **
Hash: ed77e2590987da94e9d9                                                              
Time: 4165ms
chunk    {0} scripts.bundle.js, scripts.bundle.map (scripts) 1.42 MB {4} [initial] [rendered]
chunk    {1} styles.bundle.js, styles.bundle.map (styles) 203 kB {4} [initial] [rendered]
chunk    {2} main.bundle.js, main.bundle.map (main) 576 bytes {3} [initial] [rendered]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 234 kB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in Cannot read property 'getLineAndCharacterOfPosition' of undefined

ERROR in ./src/main.ts
Module build failed: Error: /Users/johntostring/Documents/web-workspace/ng2-qyweb/src/main.ts (3,40): Cannot find module '@angular/platform-browser-dynamic'.)
/Users/johntostring/Documents/web-workspace/ng2-qyweb/src/main.ts (4,32): Cannot find module '@angular/core'.)
    at _checkDiagnostics (/Users/johntostring/Documents/web-workspace/ng2-qyweb/node_modules/@ngtools/webpack/src/loader.js:145:15)
    at /Users/johntostring/Documents/web-workspace/ng2-qyweb/node_modules/@ngtools/webpack/src/loader.js:172:17
 @ multi main
webpack: bundle is now VALID.

main.ts enter image description here

app.module.ts enter image description here

like image 923
John Zhang Avatar asked Jan 18 '17 12:01

John Zhang


2 Answers

This happens when you modify tsconfig.app.json or tsconfig.json with invalid values.

like image 90
stefdev777 Avatar answered Oct 03 '22 22:10

stefdev777


It's been too long. I might have deleted the node_modules and tried npm install again

like image 36
John Zhang Avatar answered Oct 04 '22 00:10

John Zhang