Skip to content

RC.0 on Ubuntu 16.04 any command of ng gives error #5022

Closed

Description

@mrudangit

Please provide us with the following information:

OS?

Linux hostname 4.4.0-64-generic #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Versions.

ng -v gives error
/usr/lib/node_modules/@angular/cli/bin/ng:94
const hasOldDep = !!packageJsonProject.dependencies['angular-cli'];
^

TypeError: Cannot read property 'angular-cli' of undefined
at Object. (/usr/lib/node_modules/@angular/cli/bin/ng:94:54)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3

Did this

npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clean

npm install -g @angular/cli@latest

Works fine on Winddows 10

Activity

  1. changed the title [-]RC.0 on Ubuntu 16.04 any comman of ng gives error[/-] [+]RC.0 on Ubuntu 16.04 any command of ng gives error[/+] on Feb 26, 2017
  2. danimality commented on Feb 26, 2017

    @danimality

    I had a similar error on OSX which seemed to stem eventually from not having a devDependencies key in my package.json - I added devDependencies and dependencies as empty objects to my package.json and then ng started working!

  3. mrudangit commented on Feb 26, 2017

    @mrudangit
    Author

    I can't even create a project to begin with.

    even ng -v gives eror

  4. jwuliger commented on Feb 26, 2017

    @jwuliger

    Hello I have the same problem but on Windows 10. Completely fresh install of everything from scratch and just trying to use ng help throws the following:

    Stack Trace:

    const hasOldDevDep = !!packageJsonProject.devDependencies['angular-cli'];
                                                               ^
    
    TypeError: Cannot read property 'angular-cli' of undefined
        at Object.<anonymous> (C:\Users\jwuliger\AppData\Roaming\nvm\v7.6.0\node_modules\@angular\cli\bin\ng:95:60)
        at Module._compile (module.js:571:32)
        at Object.Module._extensions..js (module.js:580:10)
        at Module.load (module.js:488:32)
        at tryModuleLoad (module.js:447:12)
        at Function.Module._load (module.js:439:3)
        at Module.runMain (module.js:605:10)
        at run (bootstrap_node.js:422:7)
        at startup (bootstrap_node.js:143:9)
        at bootstrap_node.js:537:3
    

    So I am not even dealing with a project yet. What am I missing here? Did something change with how you are supposed to install the CLI in RC0?

    Thanks.

  5. altschuler commented on Feb 26, 2017

    @altschuler

    @jwuliger Did you remove angular-cli from your package.json?

  6. jwuliger commented on Feb 26, 2017

    @jwuliger

    @altschuler Oh yeah, I had that removed already. Everything was working with Beta.32-3. Its odd I am investigating now.

  7. danimality commented on Feb 26, 2017

    @danimality

    what happens if you manually create a package.json with an empty object for the dev dependencies?

  8. jwuliger commented on Feb 27, 2017

    @jwuliger

    What was strange is I had just installed the cli globally using NPM. I wasn't even creating a project yet. I was fiddling with some things and now everything works except trying to run an NG4 version.

  9. cdarken commented on Feb 28, 2017

    @cdarken

    As @mrudangit said, the error appears when trying to run ng new. It runs inside an older project. But how do we create a new one? :)

  10. cdarken commented on Feb 28, 2017

    @cdarken

    Found this commit: 211270d
    It looks like that might prevent the error.

  11. ronenwo commented on Mar 2, 2017

    @ronenwo

    created a package.json as @danimality suggested and it worked for me

  12. filipesilva commented on Mar 14, 2017

    @filipesilva
    Contributor

    Closing as it seems to be sorted.

  13. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    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.

  14. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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