Generate component at angular

Asked

Viewed 57 times

4

When I execute the command

ng generate component configure-notification/configure-notification-edit --module app 

he gives the following error:

/usr/bin/ng: line 40: exec: generate: not found

before I could create normally...

am using linux Mint, 18.3

the output of the ng --version command

/usr/bin/ng: line 40: exec: --: invalid option
exec: usage: exec [-cl] [-a name] [command [arguments ...]] [redirection ...]

output from file /usr/bin/ng:

#!/bin/bash
# Copyright (c) 2000 Yasuhiro Take <[email protected]>
# Copyright (c) 1999 Fumitoshi UKAI <[email protected]>
# Copyright (c) 1999 Jacobo Tarrio Barreiro <[email protected]>
# This program is covered by the GNU General Public License version 2
#

if [ -n "$NG" ]; then
  test -x /usr/bin/$NG && exec /usr/bin/$NG "$@"
fi

test -x /usr/bin/ng-cjk-canna && NG=/usr/bin/ng-cjk-canna
test -x /usr/bin/ng-cjk && NG=/usr/bin/ng-cjk
test -x /usr/bin/ng-latin && NG=/usr/bin/ng-latin

if [ -x /usr/bin/locale ]; then
  eval `locale`
fi
locale=${LC_ALL:-$LANG}

case X"$locale" in
  Xja|Xja_JP|Xja_JP.*)
    [ -x /usr/bin/ng-latin ] && NG=/usr/bin/ng-latin
    [ -x /usr/bin/ng-cjk ] && NG=/usr/bin/ng-cjk
    [ -x /usr/bin/ng-cjk-canna ] && NG=/usr/bin/ng-cjk-canna
    ;;
  Xko|Xko_KR|Xko_KR.*|Xzh|Xzh_CN|Xzh_CN.*)
    [ -x /usr/bin/ng-latin ] && NG=/usr/bin/ng-latin
    [ -x /usr/bin/ng-cjk-canna ] && NG=/usr/bin/ng-cjk-canna
    [ -x /usr/bin/ng-cjk ] && NG=/usr/bin/ng-cjk
    ;;
  *)
    [ -x /usr/bin/ng-cjk-canna ] && NG=/usr/bin/ng-cjk-canna
    [ -x /usr/bin/ng-cjk ] && NG=/usr/bin/ng-cjk
    [ -x /usr/bin/ng-latin ] && NG=/usr/bin/ng-latin
    ;;
esac

if [ -n $NG ]; then
  exec $NG "$@"
else
  echo "Neither ng-latin, ng-cjk, nor ng-cjk-canna found."
  echo "Please install what you prefer."
fi

Thank you.

  • This command is supposed to show a message all beautiful with the information of the various parts of the angular core. The angular cli must not have been correctly installed on your machine and it is advisable to reinstall, either globally or locally.

1 answer

1

Edited

Viewing the file /usr/bin/ng realize that you are having package conflict, you have installed on your machine the package ng-common recommend you do the following:

Uninstall the ng-common package and any other dependent packages, and then re-install the angular as I commented below.

sudo apt-get remove --auto-remove ng-common

Reinstallation

Follow commands to uninstall:

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

After that check with the command: ng-version

If error occurs then you actually uninstalled :)

Then install again :

npm install -g @angular/cli

Remarks :

  • Using --force you clear all cache

  • Utilize sudo ($ sudo <comando>)

  • If you are using the npm version smaller than the5 it will be necessary to do the cache check. ($ npm cache verify)

  • 1

    changed the question

  • 1

    I uninstalled and installed it again... and did nothing

  • Strange, it seems that there is another package that is called with ng installed on your machine, can post here the output of the file /usr/bin/ng

  • 1

    updated the question

  • @Bruna I updated my answer, I hope now solve :)

  • @Bruna But installed again through the repositories or by downloading the page Official ? Is that the repositories of Mint has very old versions of some software, of which one of them is Node.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.