我需要在 https 端口 443 上运行我的 Angular 应用程序。为此,我需要以ng
root 身份运行。但是,我无法让 Angular CLI 以 root 身份安装。有什么建议么?
root@develop:~# n v9.4.0
install : node-v9.4.0
mkdir : /root/n/n/versions/node/9.4.0
fetch : https://nodejs.org/dist/v9.4.0/node-v9.4.0-linux-x64.tar.gz
######################################################################### 100.0%
installed : v9.4.0
root@develop:~# npm install -g @angular/cli
/root/n/bin/ng -> /root/n/lib/node_modules/@angular/cli/bin/ng
> @angular/cli@8.2.0 postinstall /root/n/lib/node_modules/@angular/cli
> node ./bin/postinstall/script.js
sh: 1: node: Permission denied
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @angular/cli@8.2.0 postinstall: `node ./bin/postinstall/script.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @angular/cli@8.2.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-08-07T14_07_14_142Z-debug.log