My angular project fails to build when I try to build for prod (ng build --prod). Please note ng build seems to work fine.
I get the below error when I try to build with --prod option
Error: ENOENT: no such file or directory, mkdir 'C:\dev\workspaces\intellij-workspaces\myproject\web\target\frontend'
at Error (native)
at Object.fs.mkdirSync (fs.js:922:18)
I have set my angular-cli outDir as below
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "web"
},
"apps": [
{
"root": "src",
"outDir": "../../../target/frontend",
"deployUrl": "myproject-dashboard/",
"assets": [
"assets",
"favicon.ico"
],
My package.json and angular-cli.json files are present under myproject/web/src/main/frontend
So, ideally based on the relative path set for outDir in angular-cli.json, I would expect a folder called target to be created under myproject/web folder and all my build output to be available there.
Please can you let me know if I should be creating the target folder manually or it there a way to tell angular-cli to create it automatically?
"outDir": "dist"
does that work for you this way? Do you have a permissions to write to../../../target/frontend
? What is yourng -v
? I just set"outDir": "../../target/frontend"
and have no issues to runng build --prod
using cli1.3.2
and node7.8
– angularrocks.com