Syntax Error in Angular App: Unexpected token <

后端 未结 30 2108
独厮守ぢ
独厮守ぢ 2020-12-02 20:16

I have an Angular app which runs perfectly in my local and production environment.. After a tiny change I made, I ran the app locally and it works fine.. Then I built the pr

30条回答
  •  死守一世寂寞
    2020-12-02 20:20

    I also had the same problem a couple of times, I solved it this way:

    Build the project with a user other than root (ubuntu - normaluser)

    root$ chown -R ubuntu:ubuntu my-project-folder/
    ubuntu$ cd my-project-folder/
    ubuntu$ npm install 
    ubuntu$ ng build -xxx params xx etc
    

    In production server show nginx user :

    root$ grep -rh user /etc/nginx/*
    user www-data; # in my case
    

    Now move or replace my-project-folder

    root$ mv my-project-folder/ /var/www/awesome.com
    

    And change permissions to nginx user

    root$ chown -R www-data:www-data /var/www/awesome.com
    

    (Y)

提交回复
热议问题