Building react Photoshop Samples

I am beginning to learn React following a course.
When trying to watch or build Photoshop Samples I get this error:

[webpack-cli] Failed to load 'D:\UXP\ui-react-starter\webpack.config.js' config
[webpack-cli] Invalid options object. Copy Plugin has been initialized using an options object that does 
not match the API schema.
 - options[0] should be an object:
   object { patterns, options? }

It looks like I have the wrong version of “webpack.config.js” for my setup. I tried to correct the error, but being a newbie i can’t find the answer.
I am using npm --version 8.1.2, node --version 16.13.2 & yarn --version 1.22.17
Is there an up to date version of “webpack.config.js” or can someone be generous and help me with the correction or do I have to get an older version of npm?

Hi @pdophoto, those versions for npm, node, and yarn should be fine. I see you’re trying to run the ui-react-starter sample. If you’re in the root directory and run yarn build, can you send me the logs you get there?

Thanks for the quick reply.
I got the following:

PS D:\UXP\ui-react-starter> yarn build
yarn run v1.22.17
$ webpack --mode development
[webpack-cli] Failed to load 'D:\UXP\ui-react-starter\webpack.config.js' config
[webpack-cli] Invalid options object. Copy Plugin has been initialized using an options object that does 
not match the API schema.
 - options[0] should be an object:
   object { patterns, options? }
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Had you already run yarn install to install dependencies?

I did with npm install

Try upgrading to these versions. This is what I am using. Screen Shot 2022-02-17 at 11.15.58 AM

OK I thought I had the last versions
Thank you so much

1 Like

Node v17+ may throw an error with webpack, but webpack has solved it with their latest update (not captured in the package.json) → so you may need to npm install webpack@latest

Thanks, I will see tomorrow

Ok, I give up.
The samples need to be updated, which an 80 year old newbie like myself can’t do.
How can I learn if I can’t see examples.
Back to my website course
And a BIG THANKS to amamdah for her help

Finally found the solution.
The samples are so out of date that you need to compile with node version 16.4.0 at https://nodejs.org/download/release/latest-gallium/

DO NOT FIX AFTER INSTALLING PROCEED TO BUILD

Hope this will help newbies

1 Like