Skip to content

'Cannot find name ..' in new project #6610

@MasDevProject

Description

@MasDevProject

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

angular-cli v1.1.0
macOS Sierra
node 6.10.0

Repro steps.

I just updated angular-cli (v1.1) and created a new project using ng new.
Then I added and installed two dependencies to the project.json file:

    "dependencies": {
        ...
        "toastr": "2.1.2",
    	"spin": "0.0.1"
      },
      "devDependencies": {
        ...
        "@types/toastr": "2.1.32",
    	"@types/spin": "2.3.30",
        ...
        "typescript": "~2.3.3"
      }

and to angular-cli.json:

"scripts": [
        "../node_modules/toastr/build/toastr.min.js",
				"../node_modules/spin/dist/spin.min.js"
      ],

Then I updated the autogenerated app.component.ts adding this constructor:

    constructor() {
        toastr.success('Hi')
    }

The IDE (visual studio code) recognize correctly the types but when I serve the application using ng serve I get the following error.

(I have a couple of project started 2 or 3 months ago and everything works fine)

The log given by the failure.

ERROR in ../A/src/app/app.component.ts (15,5): C
annot find name 'toastr'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions