Angular-cli: Cannot find name 'localStorage' or any other built-in modules after updating to RC

Created on 1 Mar 2017  路  6Comments  路  Source: angular/angular-cli

OS

macOS Sierra 10.12.3

Versions.

@angular/cli: 1.0.0-rc.0
node: 7.6.0
os: darwin x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-rc.0
@angular/compiler-cli: 2.4.8

Repro steps.

I recently re-installed my operating system. And i installed latest versions of node and angular-cli.

  1. Created new app using ng new <name>
  2. Created a new component which required storing data in localStorage.

In code editor, it shows compiler error. But it runs without error. I also have an application which was created by angular-cli-beta. It doesn't show any compiler error in that.

I don't know if it is an issue for angular-cli or vscode. Do let me know.

The log given by the failure.

screen shot 2017-03-01 at 12 13 15 pm
**well in line number 47

Mention any other details that might be useful.

I also have uploaded the code on github.
You can find repository here.
My tsconfig.json file.
My package.json file.
I have commented on a specific file to elaborate the issue. You can it here (logout function at the bottom of the page)

I hope this helps.

Most helpful comment

I updated my tsconfig.json. added dom in lib property of compilerOptions (like this) and restarted IDE. And it worked.

All 6 comments

There was an issue with tsconfig. Added a field there and it was working.

Can you explain what the issue was and how you fixed this? I've got almost the same error.

I updated my tsconfig.json. added dom in lib property of compilerOptions (like this) and restarted IDE. And it worked.

Same problem here.

The above solution solve the problem. Thanks @ndkcha

Thanks @ndkcha. I didn't even need to restart VS Code.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hareeshav picture hareeshav  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

ericel picture ericel  路  3Comments

sysmat picture sysmat  路  3Comments