Skip to content
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

stencil bundle error for stencil cli version 1.12.2 #325

Closed
ElynJin opened this issue Aug 7, 2017 · 17 comments
Closed

stencil bundle error for stencil cli version 1.12.2 #325

ElynJin opened this issue Aug 7, 2017 · 17 comments
Labels

Comments

@ElynJin
Copy link

ElynJin commented Aug 7, 2017

When I ran stencil bundle, it gives error:
events.js:141
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, open 'D:\xxxxx\xxxxx\stencil\assets\dist\theme-bundle.chunk.0.js'
at Error (native)

@CThiebaut
Copy link

+1, I get the same error.

@PreciselyAlyss
Copy link
Contributor

@ElynJin @CThiebaut Can y'all please provide me with:

  • Operating system
  • Base theme and theme version (e.g. Cornerstone 1.8.2)
  • What changes you made before attempting to bundle

@ElynJin
Copy link
Author

ElynJin commented Aug 8, 2017

Win10 64bit
Cornerstone 1.9.1
Only downloaded it for test, didn't do any change.

@ElynJin
Copy link
Author

ElynJin commented Aug 8, 2017

I noticed when run stencil start, it will generate 'assets/dist' files, then run stencil bundle, it will clear 'assets/dist' files and gives error(I guess it will regenerate 'assets/dist' files after clear them, but it doesn't, and then gives error)

With this guess, I looked into webpack.conf.js and commented out this code,
/new CleanWebpackPlugin(['assets/dist'], {
verbose: false,
watch: false,
}),
/

After this, I run stencil start and stencil bundle, it doesn't give error, and then I uploaded it, it also displayed correctly on front-end.

@PreciselyAlyss
Copy link
Contributor

@ElynJin I've opened an internal ticket to address this, but in the meantime, it seems your fix suffices.

@ElynJin
Copy link
Author

ElynJin commented Aug 28, 2017

@PreciselyAlyss The stencil bundle can run with no error after I commented out that code, but there is another problem.
After bundled the theme, the xxx.zip/assets/dist/theme-bundle.main.js is not compressed and this file is too big, it will affect the speed of the site.

@jesseconnr
Copy link

jesseconnr commented Aug 30, 2017

This error seems to be because stencil begins zipping the files before webpack is finished.

Ex. This runs instantly and stencil starts trying to zip everything up instead of waiting on the process.send('done');.

webpack(webpackConfig).run(err => {
        if (err) {
            console.error(err.message, err.details);
            throw err;
        }
        process.send('done');
    });

https://github.com/bigcommerce/cornerstone/blob/master/stencil.conf.js#L55

@jesseconnr
Copy link

This issue can be resolved by converting your stencil.config.js back to the style used a few versions back, which depend on the callbacks passed to the development and production functions. This allows you to keep the CleanWebpackPlugin in play.

See this for an example: https://github.com/bigcommerce/cornerstone/blob/1.6.2/stencil.conf.js


Additionally, unrelated, but not sure where else to put it. If anyone experiences 'Possible unhandled rejection' errors in the newest versions, you can resolve it by placing delete global.System above compiler.run in the config file. This is caused by the jspm import in the tool, which loads systemjs, which adds the global.System variable and breaks paths in some cases on Windows systems when Webpack's loader-runner uses the System.import from the global variable.

webpack/loader-runner#16

webpack/webpack#2411 (comment)

@PreciselyAlyss
Copy link
Contributor

PreciselyAlyss commented Sep 5, 2017

@jesseconnr @ElynJin @CThiebaut Commenting out the cleanwebpackplugin will address this as a temporary fix. We are investigating internally to provide a more long term solution

/*new CleanWebpackPlugin(['assets/dist'], {
      verbose: false,
      watch: false,
    }),*/ 

@finnysamuel
Copy link

As @ElynJin mentioned, the size of the bundle.js does get bloated if we comment out CleanWebpackPlugin. The workaround I've found is that run the stencil bundle a second time after the 'Error: ENOENT: ' is seen. This time, bundle finishes, but the dist folder will not be there in the assets folder in the zip file (as it gets created much later after the zipping is finished). Then after verifying that dist folder is created in the assets folder in the project folder, manually add the assets folder to the zip file (I've 7zip installed and hence I can do this by right clicking on assets folder, selecting 7-zip, add to archive)

@jbruni
Copy link
Contributor

jbruni commented Apr 23, 2018

@finnysamuel - Yeah... I've also added assets/dist manually a few times. I've investigated what was going on and was able to workaround. I've reported my findings in the issue linked above.

@jeremysimmons
Copy link
Contributor

I just ran into this time suck today. @karen-white what's the status on this bug?

@karen-white
Copy link
Contributor

Hi @jeremysimmons , we do have an internal ticket to address this. I'll update this thread when there is a fix, but I don't have a timeline at the moment.

@mattolson
Copy link
Contributor

For everyone waiting on this bug, I apologize. We will do better in the future of watching this space for bug reports and acting more quickly on them. See #413 for the fix, which will be released in version 1.15.2.

@jeremysimmons
Copy link
Contributor

huzzah. maybe the other community pull requests could get merged as well?

@mattolson
Copy link
Contributor

@jeremysimmons We are putting together a process to do a regular review of all our community issues and pull requests. The storefront team appreciates the time all of you have put into these repos, and we'll make sure going forward that we collaborate with you in a timely fashion. We'll put together an update to our contribution guide to set the right expectations in that regard.

@mattolson
Copy link
Contributor

Fixed in 1.15.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants