bigcommerce / cornerstone

The BigCommerce Cornerstone theme
https://developer.bigcommerce.com/stencil-docs
287 stars 605 forks source link

Stencil Bundle fails with error Cannot read properties of undefined (reading 'has') #2428

Closed rsdancey closed 6 months ago

rsdancey commented 7 months ago

Attempting to run stencil bundle

after ok --- Template Parsing Finished

The command generates a list of errors:

isModuleDeclaration has been deprecated, please migrate to isImportOrExportDeclaration at isModuleDeclaration (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/types/lib/validators/generated/index.js:2748:35) at PluginPass.Program (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/babel-plugin-lodash/lib/index.js:102:44)

this is followed by a series of messages like this:

Error parsing bundle asset "/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/assets/dist/theme-bundle.chunk.395.js": no such file

Then the command fails with multiple errors which appear to be related to something in babel-loader

ERROR in ./assets/js/theme/account.js Module build failed (from ./node_modules/babel-loader/lib/index.js): TypeError: /Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/assets/js/theme/account.js: Cannot read properties of undefined (reading 'has') at resolvePath (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/babel-plugin-lodash/lib/importModule.js:22:24) at importModule (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/babel-plugin-lodash/lib/importModule.js:36:53) at memoized (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/lodash/memoize.js:62:23) at /Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/babel-plugin-lodash/lib/index.js:217:63 at arrayEach (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/lodash/_arrayEach.js:15:9) at forEach (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/lodash/forEach.js:38:10) at /Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/babel-plugin-lodash/lib/index.js:193:30 at arrayEach (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/lodash/_arrayEach.js:15:9) at forEach (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/lodash/forEach.js:38:10) at /Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/babel-plugin-lodash/lib/index.js:181:28 at arrayEach (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/lodash/_arrayEach.js:15:9) at forEach (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/lodash/forEach.js:38:10) at PluginPass.Program (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/babel-plugin-lodash/lib/index.js:170:26) at newFn (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/traverse/lib/visitors.js:160:14) at NodePath._call (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/traverse/lib/path/context.js:46:20) at NodePath.call (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/traverse/lib/path/context.js:36:17) at NodePath.visit (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/traverse/lib/path/context.js:82:31) at TraversalContext.visitQueue (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/traverse/lib/context.js:86:16) at TraversalContext.visitSingle (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/traverse/lib/context.js:65:19) at TraversalContext.visit (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/traverse/lib/context.js:109:19) at traverseNode (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/traverse/lib/traverse-node.js:22:17) at traverse (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/traverse/lib/index.js:52:34) at transformFile (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/core/lib/transformation/index.js:82:31) at transformFile.next () at run (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/core/lib/transformation/index.js:24:12) at run.next () at transform (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/@babel/core/lib/transform.js:22:33) at transform.next () at step (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/gensync/index.js:261:32) at /Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/gensync/index.js:273:13 at async.call.result.err.err (/Users/ryandancey/AEG Business Dropbox/Marketing/[OFFICIAL ARCHIVE]/ALDERACSTORE.COM STENCIL FILES/git.cornerstone/node_modules/gensync/index.js:223:11)

When running stencil start the command generates the same errors but does get all the way to

[Browsersync] Reloading Browsers...

And I can load the page at localhost:3000

versions:

npm -v: 9.5.0 nvm -v: 0.39.1 node -v: 18.15.0 stencil --version: 7.3.1

I am using a clean pull of stencil I pulled this morning from git

rsdancey commented 7 months ago

Possibly related: when following the directions for an install of the stencil-cli here:

https://developer.bigcommerce.com/docs/storefront/stencil/cli/install

for a macOS installation, webpack is not installed and needed to be installed manually via npm

rsdancey commented 7 months ago

after manually installing webpack and webpack-cli,

webpack --version: webpack: 5.90.1 webpack-cli: 4.10.0

BC-krasnoshapka commented 7 months ago

@rsdancey yes, installing npm packages is needed and it's next step of the setup. Do you still have this issue after installing packages?

rsdancey commented 7 months ago

all the steps on that page have been followed. I assume stencil start would fail totally if they had not. stencil start does work (although it throws all the same errors as stencil bundle)

BC-krasnoshapka commented 7 months ago

FYI we'll investigate this further and get back.

rsdancey commented 7 months ago

@BC-krasnoshapka thank you!

rsdancey commented 7 months ago

@BC-krasnoshapka I believe I have resolved this error.

My original setup for this project used a DropBox folder. That has worked for years. I have moved the project to a volume on my local storage and then followed all the setup, install and initialization steps

stencil bundle now completes successfully

PSCPeter commented 6 months ago

Does it complete with the warning still throwing? I am still seeing it on my repositories. I can bundle and push just fine, but I do see the same warning message.

BC-krasnoshapka commented 6 months ago

@PSCPeter that warning is not critical for bundling a theme, we're working on fixing it.

bc-yevhenii-buliuk commented 6 months ago

@rsdancey these warnings in the terminal are not critical for the correct operation of the theme, but if you want to remove them, you can find a workaround in the PR.