首页 > 解决方案 > 使用 Angular 在 Linux 下编译现有项目?

问题描述

我们需要编译一个现有的 Angular 项目,该项目是在 Linux 中在 Windows 10 下成功开发和编译的。

起初我在 Windows 10 中安装了 WSL Ubuntu。我做得npm install很好。然后我尝试使用ng build --prod --base-href /IC/(在 Windows 上工作)构建我的项目并坚持下去

92% chunk asset optimization TerserPlugin 

我在网上阅读并了解到这是在 WSL 上运行的常见问题。所以我在 hyper-v 下设置了一个 Ubuntu VM,安装了 node 和 npm 并再次尝试。

这一次,在运行时npm install我遇到了一些错误,但是如果我运行,sudo npm install我会传递这些错误并看到node-sass@4.11.0编译了一些 c 文件,然后失败并显示以下内容:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.11.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.11.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!     /home/ophir/.npm/_logs/2019-11-17T09_53_45_418Z-debug.log

关于如何在 Linux 上编译 Angular 项目的任何想法?

标签: angularlinuxnpm

解决方案


推荐阅读