angular / quickstart

Angular QuickStart - source from the documentation
MIT License
3.11k stars 3.14k forks source link

npm start failed with error TS2305: Module '"{folder path}/node_modules/@angular/core/index"' has no exported member 'Component'. #170

Closed jobyjohnkj closed 8 years ago

jobyjohnkj commented 8 years ago

Hi I am facing an issue while starting angular\quickstart . if i try after deleting app folder, then npm start is running the lite-server.

following are the version details. node -v = v6.3.1 npm -v = 3.10.5 tsc -v Version 1.8.10 typings -v 1.3.2

E:\Work\angularjs\1ng2-myproj1>npm start

angular2-quickstart@1.0.0 start E:\Work\angularjs\1ng2-myproj1 tsc && concurrently "tsc -w" "lite-server"

app/app.component.ts(1,10): error TS2305: Module '"E:/Work/angularjs/1ng2-myproj1/node_modules/@angular/core/index"' has no exported member 'Component'. node_modules/@angular/core/index.d.ts(13,15): error TS2307: Cannot find module './src/metadata'. node_modules/@angular/core/index.d.ts(14,15): error TS2307: Cannot find module './src/util'. node_modules/@angular/core/index.d.ts(15,15): error TS2307: Cannot find module './src/di'. ....

other observations _There is index.js file is available in "node_modules/@angular/core/index". src folder is NOT available in "node_modules/@angular/core/" src folder is available "nodemodules/@angular/core/esm"

E:\Work\angularjs\1ng2-myproj1\npm-debug.log 0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Users\jobyj\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'start' ] 2 info using npm@3.10.5 3 info using node@v6.3.1 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle angular2-quickstart@1.0.0~prestart: angular2-quickstart@1.0.0 6 silly lifecycle angular2-quickstart@1.0.0~prestart: no script for prestart, continuing 7 info lifecycle angular2-quickstart@1.0.0~start: angular2-quickstart@1.0.0 8 verbose lifecycle angular2-quickstart@1.0.0~start: unsafe-perm in lifecycle true 9 verbose lifecycle angular2-quickstart@1.0.0~start: PATH: C:\Users\jobyj\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;E:\Work\angularjs\1ng2-myproj1\node_modules.bin;C:\Program Files\nodejs;C:\Users\jobyj\AppData\Roaming\npm;C:\Program Files\nodejs\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\jobyj.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\jobyj\AppData\Roaming\npm 10 verbose lifecycle angular2-quickstart@1.0.0~start: CWD: E:\Work\angularjs\1ng2-myproj1 11 silly lifecycle angular2-quickstart@1.0.0~start: Args: [ '/d /s /c', 'tsc && concurrently "tsc -w" "lite-server" ' ] 12 silly lifecycle angular2-quickstart@1.0.0~start: Returned: code: 2 signal: null 13 info lifecycle angular2-quickstart@1.0.0~start: Failed to exec start script 14 verbose stack Error: angular2-quickstart@1.0.0 start: tsc && concurrently "tsc -w" "lite-server" 14 verbose stack Exit status 2 14 verbose stack at EventEmitter. (C:\Users\jobyj\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:242:16) 14 verbose stack at emitTwo (events.js:106:13) 14 verbose stack at EventEmitter.emit (events.js:191:7) 14 verbose stack at ChildProcess. (C:\Users\jobyj\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14) 14 verbose stack at emitTwo (events.js:106:13) 14 verbose stack at ChildProcess.emit (events.js:191:7) 14 verbose stack at maybeClose (internal/child_process.js:852:16) 14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5) 15 verbose pkgid angular2-quickstart@1.0.0 16 verbose cwd E:\Work\angularjs\1ng2-myproj1 17 error Windows_NT 10.0.10586 18 error argv "C:\Program Files\nodejs\node.exe" "C:\Users\jobyj\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "start" 19 error node v6.3.1 20 error npm v3.10.5 21 error code ELIFECYCLE 22 error angular2-quickstart@1.0.0 start: tsc && concurrently "tsc -w" "lite-server" 22 error Exit status 2 23 error Failed at the angular2-quickstart@1.0.0 start script 'tsc && concurrently "tsc -w" "lite-server" '. 23 error Make sure you have the latest version of node.js and npm installed. 23 error If you do, this is most likely a problem with the angular2-quickstart package, 23 error not with npm itself. 23 error Tell the author that this fails on your system: 23 error tsc && concurrently "tsc -w" "lite-server" 23 error You can get information on how to open an issue for this project with: 23 error npm bugs angular2-quickstart 23 error Or if that isn't available, you can get their info via: 23 error npm owner ls angular2-quickstart 23 error There is likely additional logging output above. 24 verbose exit [ 1, true ]

filipesilva commented 8 years ago

Hm. Your error seems to indicate some problem during the npm install. It's basically saying that one of your libs is broken (in this case, angular itself).

Can you delete node_modules and do npm install again? If that's the problem, it should fix it.

jobyjohnkj commented 8 years ago

@filipesilva Thank you ! I deleted node_modules and run npm install. it worked.

filipesilva commented 8 years ago

Awesome :D

raghuariga commented 8 years ago

@filipesilva Thank you !

I have commented main.js

//import { bootstrap } from "@angular/platform-browser-dynamic";

//import { AppComponent} from "./app.component";

//bootstrap(AppComponent);

Added this from https://angular.io/docs/ts/latest/quickstart.html

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppComponent } from './app.component'; const platform = platformBrowserDynamic(); platform.bootstrapModule(AppComponent);

It worked

vrushali1508 commented 6 years ago

ERROR in node_modules/@angular/common/src/location/location.d.ts(1,10): error TS2305: Module '"C:/Users/vl48944/ng4project/node_modules/rxjs/Rx"' has no exported member 'SubscriptionLike'.

what will be the solution for this

jjorbas commented 6 years ago

As vrushali1508 I have the same problem with release 6.0.0-rc.3 and material 5.2.4

gustavogialim commented 6 years ago

I also have the following error: ERROR in node_modules/@angular/common/src/location/location.d.ts (1.10): error TS2305: Module '"C: / Users / vl48944 / ng4project / node_modules / rxjs / Rx"' has no exported member 'SubscriptionLike'.

"dependencies": { "@angular/animations": "^6.0.0-rc.5", "@angular/cdk": "^5.2.2", "@angular/common": "^6.0.0-rc.5", "@angular/compiler": "^6.0.0-rc.5", "@angular/core": "^6.0.0-rc.5", "@angular/flex-layout": "2.0.0-beta.12", "@angular/forms": "^6.0.0-rc.5", "@angular/http": "^6.0.0-rc.5", "@angular/material": "^5.2.2", "@angular/material-moment-adapter": "^6.0.0-rc.12", "@angular/platform-browser": "^6.0.0-rc.5", "@angular/platform-browser-dynamic": "^6.0.0-rc.5", "@angular/router": "^6.0.0-rc.5", "@covalent/core": "^1.0.0", "angular2-notifications": "^1.0.1", "angular2-text-mask": "^8.0.4", "babel-polyfill": "^6.26.0", "bootstrap-sass": "^3.3.7", "class-transformer": "^0.1.9", "core-js": "^2.5.4", "hammerjs": "^2.0.8", "lodash-es": "^4.17.5", "mdi": "^2.2.43", "moment": "^2.22.0", "ngx-bootstrap": "2.0.2", "normalize.css": "^8.0.0", "numeral": "^2.0.6", "rxjs": "^5.5.6", "text-mask-addons": "^3.7.2", "vanilla-text-mask": "^5.0.1", "zone.js": "^0.8.24" }

Tataraovoleti commented 6 years ago

Hi @gustavogialim , Did you find any solution ?

gustavogialim commented 6 years ago

Hi @Tataraovoleti I could not resolve with the same packages. So I put the set down and it's working, but I could not make it work with version 6 of the Angular Packages: "dependencies": {     "@ angular / animations": "5.2.10",     "@ angular / cdk": "^ 5.2.3",     "@ angular / common": "5.2.10",     "@ angular / compiler": "5.2.10",     "@ angular / core": "5.2.10",     "@ angular / flex-layout": "5.0.0-beta.14",     "@ angular / forms": "5.2.10",     "@ angular / http": "5.2.10",     "angular / material": "^ 5.2.3",     "@ angular / material-moment-adapter": "^ 5.2.3",     "@ angular / platform-browser": "5.2.10",     "@ angular / platform-browser-dynamic": "5.2.10",     "@ angular / router": "5.2.10",     "@ covalent / core": "^ 1.0.0",     "angular2-notifications": "^ 1.0.1",     "angular2-text-mask": "^ 8.0.4",     "babel-polyfill": "^ 6.26.0",     "bootstrap-sass": "^ 3.3.7",     "class-transformer": "^ 0.1.9",     "core-js": "^ 2.5.4",     "hammerjs": "^ 2.0.8",     "lodash-es": "^ 4.17.8",     "mdi": "^ 2.2.43",     "moment": "^ 2.22.0",     "ngx-bootstrap": "2.0.3",     "normalize.css": "^ 8.0.0",     "numeral": "^ 2.0.6",     "oidc-client": "^ 1.4.1",     "rxjs": "^ 5.5.10",     "text-mask-addons": "^ 3.7.2",     "vanilla-text-mask": "^ 5.0.1",     "zone.js": "^ 0.8.24"   },   "devDependencies": {     "@ angular / cli": "1.7.3",     "@ angular / compiler-cli": "5.2.10",     "@ angular / language-service": "5.2.10",     "@ types / jasmine": "~ 2.8.6",     "@ types / jasminewd2": "~ 2.0.3",     "@ types / lodash-es": "^ 4.17.0",     "@ types / moment": "^ 2.13.0",     "@ types / node": "~ 9.6.1",     "@ types / numeral": "^ 0.0.22",     "codelyzer": "~ 4.2.1",     "jasmine-core": "~ 3.1.0",     "jasmine-spec-reporter": "~ 4.2.1",     "karma": "~ 2.0.0",     "karma-chrome-launcher": "~ 2.2.0",     "karma-cli": "~ 1.0.1",     "karma-coverage-istanbul-reporter": "^ 1.4.2",     "karma-jasmine": "~ 1.1.1",     "karma-jasmine-html-reporter": "^ 1.0.0",     "protractor": "~ 5.3.0",     "puppeteer": "^ 1.2.0",     "ts-node": "~ 5.0.1",     "tslint": "~ 5.9.1",     "typescript": "2.5.2"   }

dmotorny commented 6 years ago

Try to install:

"rxjs": "^6.0.0",
"rxjs-compat": "^6.0.0"

I had the same errors by migration from Angular 5.2.10 to 6.0.0 and It has solved the problem. Here you'll find more information: https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md Good Luck!)