noopkat / avrgirl-arduino

:girl: :pager: A NodeJS library for flashing compiled sketch files to Arduino microcontroller boards.
MIT License
506 stars 129 forks source link

React Demo build error with module imports #240

Open mleanos opened 3 years ago

mleanos commented 3 years ago

Issue Template

Please review the contribution and code of conduct guidelines.

Description

If you raise an issue on bug/issue please provide the requested information, where not possible, please provide as many details as possible and ultimately a thorough description of your issue.

Expected behaviour

What behaviour did you expect did occur?

After a clean install of the React Demo, Running npm start should build successfully.

Actual behaviour

What unexpected behaviour occurred?

Build produces the error: ./src/style.css (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/style.css) Syntax error: Unknown word (1:1)

Operating system and version

Please provide version on the operating system etc. used.

Windows (pre version 7)

C:\> ver

Windows (Version 7 and newer)

C:\> systeminfo | findstr /B /C:"OS Name" /C:"OS Version"

OS Name: Microsoft Windows 10 Professional OS Version: 10.0.19043 Build 19043

Linux and Unix based systems

$ uname -a

For information on the specific distribution. Please consult your distribution documentation.

Avrgirl Arduino version

Please provide version on the Avrgirl Arduino version used

If working in a fork of the GitHub project, obtain this information post installation using:

$ npm list | grep avrgirl-arduino

If you are working on code, which has diverged from the lastest release, please mention this.

NodeJS version

Please provide version on the Node version used.

$ node --version

v12.18.1

Arduino Board being used

Please provide version/model on the Arduino board being used.

_A full List of boards and processor names are available on Wikipedia._

Log output, if available

Please add any log output, which can be used to describe the issue or circumstances surrounding the issues.

There is a property you can use named megaDebug that is passed into the instance options. This will output much more low level debugging info that could help the author debug your issue more quickly. See below for how to use it:

var avrgirl = new Avrgirl({
  board: 'uno',
  debug: true,
  // turn on megaDebug mode!
  megaDebug: true
});

Step by step guide to reproducing the issue

If possible a code snipppet to demonstrate the issue or a throught step by step description of how to get reproduce the error.

Running the example based on the steps described in the React Demo README.

If I comment out the CSS import here, I get another error which seems to be a symptom of the same issue:

Failed to compile.

./src/avrgirl-arduino.js
  Line 1:1:  Parsing error: Unexpected token

> 1 | ../../../../../dist/avrgirl-arduino.js
    | ^

I'm not familiar with the technique of importing files/modules that these two files are attempting to accomplish. Perhaps this is a limitation of being on a Windows machine: CSS import file & avrgirl-arduino module

kidfromjupiter commented 3 months ago

Ran into this as well. How did you fix this?

kidfromjupiter commented 3 months ago

I think this may be due to some error in outdated dependencies. I copied the App.js into a new Nextjs project and patched 2 lines in avrgirl-arduino.js. Have no idea why it didn't work or why my patch worked. But it works with NextJS and uploads successfully to my Uno.