ng: command not found

前端 未结 11 1508
伪装坚强ぢ
伪装坚强ぢ 2020-12-21 00:22

I am trying to run ng build in my project folder, but I get the following response:

bash: ng: command not found

Wha

11条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-21 01:03

    In my case, I have just copied a whole repository (including its node_modules) from a Windows machine to a Linux machine, and running npx ng XXX failed with the following error:

    npx: installed 1 in 1.677s
    command not found: ng
    

    The main issue was, of course, line breaks. Using the dos2unix package, I was able to overcome it:

    sudo apt install -y dos2unix
    dos2unix node_modules/.bin/ng
    chmod +x node_modules/.bin/ng
    

提交回复
热议问题