cncjs / cncjs-widget-boilerplate

Creating custom widgets for CNCjs
https://cncjs.github.io/cncjs-widget-boilerplate/
MIT License
11 stars 15 forks source link

Not working on Windows #1

Open GorillaMachines opened 6 years ago

GorillaMachines commented 6 years ago

When i attempt to run the dev server by sending the command npm run dev in the command prompt it accepts the command, but fails due to the "webpack" not being recognised as a command. Here is what it responds with-

cncjs-widget-boilerplate@0.2.0 build C:\Users\isano\Documents\GitHub\cncjs-widget-boilerplate webpack --config webpack.config.js

'webpack' is not recognized as an internal or external command, operable program or batch file. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! cncjs-widget-boilerplate@0.2.0 build: webpack --config webpack.config.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the cncjs-widget-boilerplate@0.2.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\isano\AppData\Roaming\npm-cache_logs\2017-10-27T16_28_36_558Z-debug.log

What should I do? I really need the ability to develop a widget. Thanks so much for all the work you have put into this!

GorillaMachines commented 6 years ago

Also I believe it would be not possible to compile CNCjs at all on windows because the fsevents module is not compatible with the os at all. Is this correct?

MitchBradley commented 6 years ago

I don't know the direct answer to your question, but I use Windows and I have successfully compiled cncjs - by compiling in the cloud. I use Cloud 9 - c9.io . I have started to do that for more and more things because I got tired of having to maintain multiple huge development environments locally. It is easier to have each one sandboxed in a VM instance in the cloud.

See https://github.com/cncjs/cncjs/issues/208 , particularly the Sep 21 comment, for how I got it working.

Regarding widgets, I have found it rather easy to develop "pendant style" control screens starting from the cncjs-pendant-tinyweb repo, without having to compile cncjs at all. The difference between them and "normal" cncjs widgets is as follows

With a pendant, you cannot integrated the function into the main cncjs screen, but for my needs (see cncjs-shopfloor-tablet) that was an advantage. I control my milling machine from an Android tablet and sometimes from my phone. The full-on cncjs screen is very difficult to use on a mobile device because there is just too much on one screen and too many control points. Things are always moving around and it is hard to hit the one button you need, if that button is even visible at the moment. When you try to hit a button you might instead cause the screen layout to change; conversely when you try to adjust the layout to reveal the button you need, you might instead hit the wrong button. This can be disastrous when running a machine.

With cncjs-shopfloor-tablet, my design principles are

cheton commented 6 years ago

Hi @GorillaMachines,

Have you ever run npm install to install packages prior to npm run dev?

GorillaMachines commented 6 years ago

That's what we're using

On Oct 27, 2017 7:14 PM, "Cheton Wu" notifications@github.com wrote:

Hi @GorillaMachines https://github.com/gorillamachines,

Have you ever run npm install to install packages?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cncjs/cncjs-widget-boilerplate/issues/1#issuecomment-340118871, or mute the thread https://github.com/notifications/unsubscribe-auth/AeInD9qoe3djj2OwDYk-b_ffyG-7GbTxks5swmPBgaJpZM4QJTty .

cheton commented 6 years ago

First, may I know your Node.js and NPM versions?

node -v
npm -v

According to your debug log in the first comment:

cncjs-widget-boilerplate@0.2.0 build C:\Users\isano\Documents\GitHub\cncjs-widget-boilerplate webpack --config webpack.config.js 'webpack' is not recognized as an internal or external command,

It indicates that the node_modules does not exist in your folder, so it cannot recognize the "webpack" command. To resolve this issue, you need to run npm install to install package dependencies to the local node_modules folder.

To make it compatible on Windows, I added two cross-platform tools, cross-env and del-cli, to the build script in package.json (commits: https://github.com/cncjs/cncjs-widget-boilerplate/commit/633cba7ad45153df0a0934989e103d66308683cc https://github.com/cncjs/cncjs-widget-boilerplate/commit/9b05ced2a96b64a9c4096a559e7028b8e5a8e1b7).

Now you can clone the repo again, install dependencies, and run build scripts, as below:

powershell
git clone https://github.com/cncjs/cncjs-widget-boilerplate.git
cd cncjs-widget-boilerplate
npm install
npm run build

Note: powershell is recommended when running scripts on Windows.

cheton commented 6 years ago

Prebuilt zip files are available at https://github.com/cncjs/cncjs-widget-boilerplate/releases

You can download the zip file and make sure the extracted folder can be mounted by CNCjs.

If everything works fine, you can either start a development server or build production code, and then specify the mount path to the "dist" folder to test widgets with CNCjs:

cnc -vv --mount /widget:C:\Users\isano\Documents\GitHub\cncjs-widget-boilerplate\dist

Development Server

https://github.com/cncjs/cncjs-widget-boilerplate#development

Production Code

https://github.com/cncjs/cncjs-widget-boilerplate#production

cheton commented 6 years ago

BTW, you don't need to compile CNCjs source code when developing widgets with "cncjs-widget-boilerplate". All you need to do is to specify the mount path to your dist files when starting the CNCjs server.

fbrier commented 2 years ago

When I attempt to follow the directions, the very first command "npm install" fails in the same way as described in issues:

https://github.com/cncjs/cncjs/issues/695 and https://github.com/cncjs/cncjs/issues/719

I would like to write a cncjs widget, but it appears to be very difficult to upgrade all the npm packages to the latest available. In order to build, it appeared some developers were recreating the old packages in a docker container. Is that is what is necessary?

poppabear8883 commented 1 month ago

When I attempt to follow the directions, the very first command "npm install" fails in the same way as described in issues:

cncjs/cncjs#695 and cncjs/cncjs#719

I would like to write a cncjs widget, but it appears to be very difficult to upgrade all the npm packages to the latest available. In order to build, it appeared some developers were recreating the old packages in a docker container. Is that is what is necessary?

2 yrs later and this has not been updated.

I'm also having issues, the packages here are extremely out of date and need to be updated. We can help contribute to the development if only we had a functional boilerplate AND much better documentation.

BTW, I'm on Windows desktop app.

Devs, please provide a solution or workaround so that we are not stuck wasting time.

Thanks in advance

MitchBradley commented 1 month ago

Look at the git commit history to see how much development activity there has been in the last 5 or so years. Maintaining complex software is very time consuming, and for an open source project like this one, there is very little payoff. I am a developer on an actively-maintained CNC project that gets frequent but small donations. It amounts to about 10 cents per hour of development/maintenance/support time. It is very difficult to justify the time we spend on it.

Documentation takes just as much time, if not more, as coding. One difficulty with documentation is that it is hard to know what the reader already knows or assumes, so you potentially have to explain at a very detailed level, and then you risk too much verbiage. And there is also a language problem.

If you cannot solve npm problems on your own, and cannot figure out the system by reading the code, it is unlikely that you would be able to contribute much to the development. If the system were actively maintained by a group of engaged developers, then it is possible there might be small introductory tasks that could be handed off to learners. That is not the situation here.

poppabear8883 commented 1 month ago

Look at the git commit history to see how much development activity there has been in the last 5 or so years. Maintaining complex software is very time consuming, and for an open source project like this one, there is very little payoff. I am a developer on an actively-maintained CNC project that gets frequent but small donations. It amounts to about 10 cents per hour of development/maintenance/support time. It is very difficult to justify the time we spend on it.

Documentation takes just as much time, if not more, as coding. One difficulty with documentation is that it is hard to know what the reader already knows or assumes, so you potentially have to explain at a very detailed level, and then you risk too much verbiage. And there is also a language problem.

If you cannot solve npm problems on your own, and cannot figure out the system by reading the code, it is unlikely that you would be able to contribute much to the development. If the system were actively maintained by a group of engaged developers, then it is possible there might be small introductory tasks that could be handed off to learners. That is not the situation here.

I'm simply pointing out that the deps for the widget boilerplate needs to be updated. The boilerplate has not been updated in 7 yrs ... I have been a developer for 16 yrs, I'm very capable of contributing. I understand the time it takes to maintain something as complex like this.

MitchBradley commented 1 month ago

So figure out what needs to be done, test it, and submit a PR. As a developer, you are presumably aware that staying on top of version churn is tedious, time consuming, and not nearly as much fun as designing and coding new features. It is one of those necessary evils that contributes to developers losing interest in open source projects and eventually dropping out in favor of paid work.