-
Notifications
You must be signed in to change notification settings - Fork 12k
Can't build to parent outDir folder with 1.5.4 #8613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same problem here. |
@hansl can you have a look please? |
@hansl @filipesilva @rbluethl: This issue is occuring when the outdir in .angular-cli.json is outside the angular folder. (eg. "outDir": "../../bin/Debug/www") |
@hansl @filipesilva : Same issue here. Please fix the issue. ".angular-cli.json" Config On Build |
Same problem, I'm using the outDir param to build outside my angular root folder. |
Same here |
1 similar comment
Same here |
// Prevent asset configurations from writing outside of the output path, except if the user
// specify a configuration flag.
// Also prevent writing outside the project path. That is not overridable.
const fullOutputPath = path.resolve(buildOptions.outputPath, asset.output);
if (!fullOutputPath.startsWith(projectRoot)) {
const message = 'An asset cannot be written to a location outside the project.';
throw new SilentError(message);
} What flag is told about? |
Same problem |
I think |
ya, something wrong when build.
|
I'm not sure this covers every possible scenario, but the obvious thing to do is use an npm script to copy things post-build package,json
Footnote - 'postbuild-prod' runs automatically after 'build-prod'. This is quoted from issue 8122, and seems fair enough as a precaution.
So, requiring the developer to specifically copy via script achieves both objectives. |
And what about the --watch option ? |
Patching the 1.5.4 with fix in #8630 solve the problem, so just wait for the next release. |
oh man... |
Does the merge also make |
...same problem here, what about |
#8630 solves the problem. Until the fix is released, it's better to lock the cli version at 1.5.3. |
Damn, no wonder, I was like, it was working at work before the weekend, why is it not working at home? I was scratching my head so much I am almost bald now. |
I'm glad this is being fixed. I prevent my destination folder from being deleted by the CLI with the new "no-delete-output-path" option. Not a problem.
|
Is there anybody who can help me understand how can I use the fix #8630 ? |
@djpysu They don't seem to want to fix it properly, so I have had to edit the angular/cli dist myself. It is odd how the team have been so slow on this, it is usually necessary to have a "common-assets" dir that several ui services can access such that you don't have the same "favicon.ico" or "logo.png" file copied X times. What is interesting is that with the boolean flag set ( Not sure why they implemented this to be frank. It isn't a security feature like they say because if a nefarious actor has compromised your system to such a degree that they can run your app straight off the bat, they sure can easily do what I just did and make |
Yeah, I also thought that. I updated to 1.6.4 - not working, back to 1.5.3 - not working. Only with 1.4.1 is working for me. I think I'm doing something wrong. |
can u share ur config and error message? |
Same error message like everybody: An asset cannot be written to a location outside the project. From angular-cli.json
package.json
|
Same issue with 1.6.3 and 1.6.5 when running 'ng build'
|
when will this be fixed ... |
@Sanafan You could look into it. It's marked as an easy to fix regression |
This error is still occurring in 1.7.4. It's highly problematic for a project I'm working on since I have around 5GB worth of images to serve and placing them in the assets folder causes the ng serve to crash. For anyone looking to fix it locally, edit ../node_modules/@angular/cli/models/webpack-configs/common.js. The code starts at line 99. I'm not going to make a pull request to fix it because I don't know if there is a legit reason for this functionality (although it seems odd to me and as others have mentioned, it's not really a security thing). |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions
Repro steps
apps[0].outDir
as"../dist"
on .angular-cli.jsonng b
Observed behavior
Only a error message:
An asset cannot be written to a location outside the project.
Desired behavior
Build the project without problem.
Mention any other details that might be useful (optional)
We have tried to add
allowOutsideDir
to ours assets configuration on cli config, but doesn't work. Is this the expected behaviour? I don't found related information about it in de64b86 or #8122 :(The text was updated successfully, but these errors were encountered: