stencil icon indicating copy to clipboard operation
stencil copied to clipboard

bug: Cannot read property 'push' of undefined TypeError when trying to start the server

Open duyduong25 opened this issue 2 years ago • 5 comments

Prerequisites

Stencil Version

v2.17.4

Current Behavior

Cannot start server due to issue as below

"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" start

[email protected] start C:\cus-exp stencil build --dev --watch --serve

[00:13.7] @stencil/core [00:14.2] v2.17.4

[ WARN ] Build Warn dist-custom-elements-bundle is deprecated and will be removed in a future major version release. Use "dist-custom-elements" instead. If "dist-custom-elements" does not meet your needs, please add a comment to https://github.com/ionic-team/stencil/issues/3136.

[ WARN ] tsconfig.json "include" required In order for TypeScript to improve watch performance, it's recommended the "tsconfig.json" file should have the "include" property, with at least the app's "./src/main/ts" directory listed. For example: "include": ["./src/main/ts"]

[ ERROR ] Cannot read property 'push' of undefined TypeError: Cannot read property 'push' of undefined at m (C:\cus-exp\node_modules@stencil\core\compiler\stencil.js:8913:122459) at C:\cus-exp\node_modules@stencil\core\compiler\stencil.js:8913:121626 at watchFile (C:\cus-exp\node_modules@stencil\core\compiler\stencil.js:8913:127945) at b (C:\cus-exp\node_modules@stencil\core\compiler\stencil.js:8913:133235) at fsWatch (C:\cus-exp\node_modules@stencil\core\compiler\stencil.js:8913:132492) at watchFile (C:\cus-exp\node_modules@stencil\core\compiler\stencil.js:8913:128073) at Object.u.watchFile (C:\cus-exp\node_modules@stencil\core\sys\node\index.js:5998:15) at Object.tsSys.watchFile (C:\cus-exp\node_modules@stencil\core\compiler\stencil.js:41827:36) at watchFile (C:\cus-exp\node_modules@stencil\core\compiler\stencil.js:8913:2137875) at C:\cus-exp\node_modules@stencil\core\compiler\stencil.js:8913:2139299

Expected Behavior

The server is able to run on local machine

Steps to Reproduce

  • npm install
  • npm start

Code Reproduction URL

...

Additional Information

I did try to clone new repo to another folder, clean npm cache, init a new stencil repot. The issue s still happening.

duyduong25 avatar Sep 06 '22 09:09 duyduong25

Hey @duyduong25,

Can you do me a favor and try to create a minimal reproduction case for the team to look at? I wasn't able to reproduce this with a new stencil component starter on Windows (npm init stencil component) like you said you were able to do in the 'Additional Info' section. This might be related to your environment, although its difficult to tell at the moment. Thanks!

rwaskiewicz avatar Sep 06 '22 12:09 rwaskiewicz

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Stencil starter component library and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

ionitron-bot[bot] avatar Sep 06 '22 12:09 ionitron-bot[bot]

Hi @rwaskiewicz ,

just fyi, I have the code base in front of me and am able to build and start it, as are other colleagues. I think it's a problem with @duyduong25 's environment. Unfortunately, I'm unable to help, since I'm not sure what stuff Stencil is doing at that point which causes it to fail. Do you have any recommendations what to try?

minecrawler avatar Sep 06 '22 12:09 minecrawler

@minecrawler @duyduong25 A few things that you may be able to compare between your machines/environments to root cause:

  • OS (it looks like @duyduong25 is on a Windows machine, although I don't know if that's the same for the rest of the team)
  • Node/NPM versions
  • Directory structures & permissions (I would check this, as there may be an issue where a directory is readonly here)
  • Verifying that the team can start it the same way @duyduong25 is describing (I.E. following the same instructions/commands, in order)

rwaskiewicz avatar Sep 06 '22 13:09 rwaskiewicz

Thank you for your quick reply :)

* OS (it looks like @duyduong25 is on a Windows machine, although I don't know if that's the same for the rest of the team)

We should be on the same OS, since our machines are enrolled in an MS SCCM environment

* Node/NPM versions

I tried it with several versions, including @duyduong25 's (he's using 14.15, I also tried 17.4.0 and 18.5.0 using NVM)

* Directory structures & permissions (I would check this, as there may be an issue where a directory is readonly here)

Good point! I put my projects usually in my user's directory, but it looks like @duyduong25 put it on C:\

* Verifying that the team can start it the same way @duyduong25 is describing (I.E. following the same instructions/commands, in order)

We tried the same steps on both our machines.

minecrawler avatar Sep 06 '22 14:09 minecrawler

Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Stencil, please create a new issue and ensure the template is fully filled out.

Thank you for using Stencil!

ionitron-bot[bot] avatar Oct 06 '22 18:10 ionitron-bot[bot]