-
Notifications
You must be signed in to change notification settings - Fork 12k
ng serve: Cannot read property 'text' of undefined #4072
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
I was able to get But I can't do
|
Dealing with a similar issue on
Interestingly, the build succeeds with
To point directly to the environment file I'm trying to use (e.g.,
Obviously this doesn't solve anything since it breaks the whole point of the |
@Splaktar - My issue was also resolved by moving back to |
I get the same error in beta.25.5 (was working fine in beta.24):
Note: the paths in the error have been redacted. |
@Splaktar - adding the following property to my
|
@saverett I also needed to do the following in my
After that I was able to get In addition, I updated a lot of dependencies beyond what is the default in angular-cli:
|
This is still a think for me, even in beta 26, when using "ng serve --prod" but it works fine if you do "ng serve --prod --aot" |
Was this supposed to be fixed? I never had this issue until today.. |
Actually, nvm.. mine is the same error from a diff location :
|
@emoralesb05, have you found a solution for this? I have the same issue after upgrading to covalent 1.0.0-beta.1 l. I on @angular/cli-beta.31. |
Likewise getting this error on @angular/cli-beta.31, and have no clue how to go about fixing it. |
@jimdubbs, are you also using covalent? |
@istvanszoboszlai no im not using covalent. I get the below error on each of my 5 angular services wen trying to build with the --prod flag. No idea how to solve.
|
I have the same problem. Output of my
|
@emoralesb05 somehow solved it in Covalent. Maybe he knows what the root of the issue was |
In our case (covalent), it was because the CLI was picking the Removing the source files from the publishing process fixed it for us. |
@emoralesb05, can you expound on:
I've literally added one 3rd party component for a ui item, and cannot build prod. No fun. |
So, check if the 3rd party component has The CLI errored out in our case if they are there. e.g.
|
Good grief. That did it. @emoralesb05 THANK YOU. |
Ouch, I've just been bitten by this in an all-typescript monorepo. We really want to get rid of the extra compilation step and working with JS, just have ts in node_modules. |
@konrad-garus - as per @emoralesb05, it is just getting rid of source ts file of the 3rd party files that you are using, except for, of course, the ...d.ts file. Removing the one source file literally cleared up all issues for me and I have been moving forward with no issues. And it is not all ts; the js files are fine. It seems to be an issue with how some packages are being deployed. |
@MetaVurt This is exactly my point. I do want TS files in there. I have a monorepo with a bunch of TS packages managed by Lerna, which basically copies (or symlinks) the packages into node_modules. I want them to just build correctly with plain TS depedencies, so that I don't have to compile each of them to ES. |
@MetaVurt but what if I prefer to have 3rd-party libraries in TS instead of JS? It's really convenient. |
@hansl, I've just installed version 1.0.0-rc.1 and created a test project wtih
Here's the output for
And here's the output for
|
+1 |
@konrad-garus @mmiszy - well, I do not disagree with you two, but your comments are among many others who are having issues with basic installations. Either we need a way to expressly choose an option, or there is something suspect in the core build that is inhibiting development by others. Not glad or sad or mad. Waiting for this issue to actually be re-opened and worked on, as it appears to be a recurring theme. |
There's a good chance TypeScript is the future, and I'm quite sure there are many people interested in having TypeScript everywhere, without the extra build steps to JS. That's painful, inconvenient, lossy... and unnecessary. Let's make the future happen, not force everyone back into the past. |
I get the same error after upgrading from angular-cli 1.0.0-beta.19-3. I've also installed typings for socket.io and stuff like that.
Is there any way to get more debugging information to find the source of this problem? I've tried a couple of things recommended (like adding "typings.d.ts", "main", ... to tsconfig), but still no luck. I've even checked if I use a property "text" somewhere in my Code, but no. Any ideas? |
@konrad-garus I hear what you are saying, and quite possibly TS is the way of the future, except..... I have seen this before - where one thing transposes/composes into another thing - with the latter being the actual code needed, in order to accomplish the job. And at the end of the day, whatever language was being composed to, ended up, once again, being what everyone used. It is great that Microsoft launched TS in order to be a solid, stable platform that works well with Visual Studio, and they have been better at launching more open codebases than they were in the 90s. Seeing the team at Mozilla being apparently committed to quicker, smaller release sets, it seems to me JS will continue to push forward, allowing us to develop robust applications without the need for transposing any code, unless we are in an environment or have a requirement set that demands it. |
@SimonErich - I hope I am not offending when I ask this, but when you migrated, did you completely delete your node_modules directory, npm cache clear, then npm install, in order to re-install all necessary modules? There are times when I have followed the migration instructions and still had issues, until I cleared all modules, and cleared my cache. I hate to be the bearer of bad news, but you may need to install your third party additions one at a time, until you find the error message. The "text" error message has nothing to do with your personal code. It has to do with -cli tripping up on one of the third party packages, and how it was organized. |
@MetaVurt Thank you very much for your answer. After your answer I decided to try to add the main parts of the application slowly and one by one and found the mistake. For future reference: I used to export an object like this: export default {
...
}; This used to work with the older version of typescript and angular-cli. export const config = {
...
}; and now everything works. Thank you for help @MetaVurt though |
That is 100% valid TypeScript code. incidentally it is also 100% valid JavaScript. If it causes the CLI to fail the CLI is wrong. |
@SimonErich's workaround worked out for me. I was exporting my reducers as default functions. When I changed to using named functions instead, the project builds again. So it works as a workaround. Thanx @SimonErich! |
@SimonErich's trick worked for me too: I had to change
and it's working now. It would be great to have the compilation fail earlier to have a clearer error message! |
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. |
OS?
Mac OS X El Capitan
Versions.
Repro steps.
Upgrading from beta.19-3 to beta.25.5.
Run upgrade guide including merging in of
ng init
output.The log given by the failure.
Mention any other details that might be useful.
This seems to be related to https://github.com/angular/angular-cli/blob/master/packages/%40ngtools/webpack/src/loader.ts#L94 which has two calls to
.getText()
which seems to assume that all properties have aname
field and doesn't check to verify that name is defined.My
./src/environments/environment.ts
My
./src/app/app.module.ts
It would be nice if this error message was more user friendly and gave the user some idea of what property was not properly defined or what part of the code/what module was being processed.
The text was updated successfully, but these errors were encountered: