I have an application building in Nw.js. Its almost done, but now facing an issue. While on clicking nw.exe on code (development) it is opening very fast, within in 2 seconds. But when I create a build using nwbuild -p win64 . , it is taking a lot time of time, say a minute to open and giving a feeling that app is opening itself.
The code base when built, the .exe is 21 MB size. Appreciate, if some one could help me to understand why this happens and what to make it open faster.
nwbuild is not recommended by official now, maybe try nwjs-builder-phoenix or create you own distribute script. As I remember, nwjs-builder-phoenix also not handle node_modules folder size very good.
Here is how I distribute my package:
copy NW.js binaries client to dist folder
copy my working source project into a folder named package.nw(Windows) or app.nw in nwjs.app/Contents/Resources/(MacOS)
run npm prune --production under the path you just copy your source into. https://docs.npmjs.com/cli/prune.html
using npm package plist(for MacOS) or rcedit(for Windows) to change the binaries client's information about version, nanme, author ..etc
For mac these is alot of things needs to be changed if you want to publish to appstore http://docs.nwjs.io/en/latest/For%20Users/Advanced/Support%20for%20Mac%20App%20Store/
Related
Running electron-packager, I expected the resulting folder structure to be a bit neater, so that I could just zip it up and allow it to be downloaded as an app.
The main folder contains the executable app, but also a lot of .dll, .pak and .bin files. I think this may be a bit confusing to users of my app, is there any way to move all of these files into a folder when running electron packager?
The output from electron-packager is not supposed to be used by the user. It gives an output folder that you can pass into the windows installer to make an installer for users. The installer hides that messy folder under AppData\Local\appname\app-version. It uses Squirrel to do this and once configured correctly the user only sees desktop and start menu shortcuts to launch the application. Using Squirrel means it plays nicely with the Electron autoUpdater.
While using the windows installer and auto updater is recommended you could also create a shortcut to the executable created by the packager so that users don't have to see the messy folder themselves.
When I add a new package to an existing installation where yarn install has already been run, it takes 5 minutes to add a new dependency, which is as slow as if I just did yarn install without node_modules there yet.
Is this normal?
I'm using Yarn 0.17.9 on Windows 10 x64. I did make Windows Defender ignore my project directory and yarn global cache directories.
EDIT: here are some benchmark results I did. Based on them, it seems that yarn add is actually 30-40% faster, and the real issue is rather just that yarn is 500% slower on Windows
EDIT 2: I have confirmed that indexing hasn't been enabled for the project and yarn cache directories. But now I have upgraded yarn from 0.16.1 to 0.17.9 and there was a 35-50% increase in speed in Windows! But it's still 350-400% slower than in Linux. I have updated the benchmarks.
There seems to be Github issue for the Windows performance issues: https://github.com/yarnpkg/yarn/issues/990
The benchmark:
--
Windows - yarn install (cached):
Done in 172.29s.
Ubuntu - yarn install (cache):
yarn install 48,75s user 11,32s system 117% cpu 51,161 total
--
Windows - yarn add lodash:
Done in 143.11s.
Ubuntu - yarn add lodash:
yarn add lodash 33,42s user 5,72s system 108% cpu 36,203 total
--
FYI the Ubuntu benchmarks were run on the same folder on the NTFS drive.
Project that was used for the benchmarks: https://github.com/amcsi/szeremi
Disabling windows search indexing on your work folder and yarn cache folder as well as disabling windows defender completely or on a folder should give you significant performance boost. I've got 30-50% decrease on similar system with SSD drive, originally timings were as yours.
Disabling it on Yarn cache folder would also give you some speedup. Its location is shown by yarn cache dir command, %USERPROFILE%\Local Settings\Yarn\cache by default.
To disable search indexing on a folder, find it in Explorer, right click, then Properties - General - Advanced, uncheck the "Allow files in this folder to have contents indexed in addition to file properties" checkbox, then Apply the changes.
This performance issue already exists on yarn github (Oct'2016) and is still open to the moment: https://github.com/yarnpkg/yarn/issues/990
My experience...
Doing a yarn start is excruciatingly slow.
My setup.
I am running WSL2 Ubuntu 20 on windows 10 home.
I have my WSL src directory a sym link to windows c:\Users\chai (as opposed to whatever filesystem WSL has me in ie. the native WSL filesystem).
ie.
Filesystem Size Used Avail Use% Mounted on
C:\ 476G 395G 82G 83% /mnt/c
I am running the yarn which is installed via WSL2 Ubuntu (ie. so it is the linux version, not the windows version of yarn).
V v slow.
I experimented and copied the same src files into a non-symlinked directory.
ie. under ~/tmp which is a WSL filesystem and not under the windows filesystem.
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 251G 11G 228G 5% /
And the speed now is as per expected... ie. normal (or relative to previous behaviour, blindingly fast).
So I am now using the latter setup for my react projects.
For me worked downgrading from WSL2 to WSL1.
On WSL2 yarn install of my boilerplate took 890sec
on WSL1 - 245sec.
On standalone Ubuntu - 130sec.
https://github.com/microsoft/WSL/issues/4197
I used to have the same issue. It used to take 30+ Minutes to just install one package. I had my projects on an external drive and network drive and I tried adding scan virus exception path, opening firewall etc. None enhanced the speed. However, as soon as I git clone to, let say C:/New Folder/my repo. It took 1.5 seconds. I hope this resolves the issue for some developers.
I am trying to get up and running with Meteor and seeing what it can offer, while I like it overall, it seems it's a very very rigid system.
I set up a small testing setup using Velocity, it opens a small overlay window on the side which has a class of "velocityOverlay". The overlay is really small and makes error stack traces wrap. All I wanted to do was to edit the css of the "velocityOverlay" and increase the width.
I somehow (after wasting time) managed to find that Meteor is actually putting all the packages in my user directory by default, once I found that, I found the needed css file...
velocity_html-reporter/.0.5.1.aykpxq++os+web.browser+web.cordova/web.browser/packages/velocity_html-reporter/lib/client-report.less.css
And I did a small edit to the width, next thing you know the meteor app crashes when trying to launch using the "meteor" command throwing a "Error: couldn't read entire resource" error. I can't even edit the bootstrap.css file I installed using "ian_bootstrap-3".
Further more, I can't find any way to install packages locally just for my particular project, what if I wanted to modify a package only for my particular project? this is very easy to do in vanilla Node.js, you simply don't use the "-g" when using "npm install".
To add to that, within my project root, there is another ".meteor/local/build/web.browser" folder with most of the global package files replicated again. When does Meteor use which? This is very confusing.
You can run a package locally very easily.
Download it from Github (for example) and put it in the packages/ directory of your application like this /packages/package_name.
Then add it to your application with the same meteor add package_name command as usual.
Meteor will automatically look in the local folder before anywhere else and compile the package with the rest of your code.
This allows you to do any modification you want on the package and test it locally before publishing it to the registry.
Also, folders located in .meteor/local/* are used for building purpose only and are generated automatically by Meteor. So it is not the best place to edit the files!
This worked for me https://atmospherejs.com/i/publishing. mrt link-package didn't work for me, might just be outdated code.
Steps:
Download (or clone) package from GitHub to local dir
Stop meteor if running
2.1. Make sure you have a packages folder: mkdir packages
Locally link your package:
3.1 If you have mrt installed: Run mrt link-package /path/to/package in a project dir
3.2 If you don't have mrt: ln -s /path/to/package packages/package
Then run meteor add developer:package-name, do not forget to change package name
Run meteor in a project dir
From now any changes in developer:package-name package folder will cause rebuilding of project app
Download the package and place it in new package directory in your project root.
open the package.js inside the downloaded package and remove the author's name in the property "name:"
e.g: - name:'dburles:google-maps' to name:'google-maps'
then run
meteor add google-maps
Does anyone know how to install GameClosure on Windows? According to the docs, on the installation guide, only osx is supported, although they have some success running on Linux and Windows. Unfortunately they don't expand on how to do this and a Google turns up only one promising looking page which returns a 404 (there is a cached version but it only seems to be a half article).
I have successfully installed the GC DevKit on Windows, there are a few additional steps like creating symbolic links BEFORE trying to install the GC DevKit.
Follow these steps carefully and you shouldn't have a problem getting it up and running. Read through them and try to understand what is required first.
Download the list of required items (Windows builds for Git, Node and Java) from the install guide.
Open up Git Bash (find it on the start menu under Git)
Continue with the install guide by cloning the repo (git clone https://github.com/gameclosure/devkit).
The files would have been installed to %USERPROFILE% if you did not change the directory while in Git Bash.
Move all the files in devkit\SDK somewhere else but make sure they are gone from that directory.
Open a normal command-prompt (cmd.exe).
Create symbolic links for everything that WAS under the devkit\SDK directory using mklink (available in Vista and above) from the command-prompt (not the Git Bash console). The files you moved in step 5 will contain the path as text that the link should be pointed to EG: > mklink /D "%USERPROFILE%\devkit\sdk\squill" "..\lib\squill\"
JSIO is special and actually needs to exist in a sub-directory at the time of writing. Create the directory devkit\SDK\jsio and then create a symbolic link INSIDE that going back one more relative path. EG: > mklink /D "%USERPROFILE%\devkit\sdk\jsio\jsio" "..\..\lib\js.io\packages\"
Go back you your Git Bash console and now continue with the installation for GC DevKit by switching to the devkit directory running the ./install.sh script as described.
Run basil by executing node src/basil [command]
If all the correct pre-requisites were in place everything should go smoothly. If basil throws errors it's more than likely the symbolic links, just check that everything is pointing to the right place and run ./install.sh to try again.
Good luck!!
There is now a full guide to installing Game Closure SDK on Windows here (I have also posted the contents in pastebin here in case the previous link disappears)
It's quite a process to get everything installed and configured, and looks like you can only develop for Android using the windows version of the SDK, but I may be mistaken
I wasn't able to get it installed on windows, but it's easy enough to install on linux, so I ended up using virtualbox and a linux vm. Cygwin could be another option but I didn't try it so unfortunately can't say for definite whether or not it would work
I have installed Node.js on Windows (binary here http://node-js.prcn.co.cc/ ) and can successfully create an HTTP server in console.
Now I have put same instructions in helloworld.js script in bin directory and run with dos prompt
node helloworld.js
and it cannot find in /usr/bin. So I put it under Node.js install directory in usr/bin but same message. I finally tried c:/usr/bin but still failed.
So where should I put my script it on windows ?
screencopy of error
Firstly, there are no such thing as DOS prompt in Windows. And if you take effort to create one (e.g. using DosBox or another virtual machine), node.js is not supposed to be run from a DOS prompt as it's a Windows console application and not a DOS application lol. But calling Windows command prompt DOS prompt is a common misnomer, so I hope you really mean that cmd.exe prompt.
Unlike a previous commenter said, Node.js is fully supported under a complete installation of Cygwin, and almost everything works using the stripped Cygwin tree and node.js windows binaries I provide at http://node-js.prcn.co.cc.
So that /usr/bin problem is not related to an incompatibility with windows. You are even not supposed to put your .js files in bin directory of my tree - any location (and normal absolute or relative Windows path) will work.
I created an example.js in bin directory, created console.log("foo") line in it, went to start menu - windows prompt, cd to the bin directory and executed node helloworld.js without any problems.
So as I cannot reproduce your problem, I have a few questions for you:
1) Does node -v work? If yes, what does it say?
2) Did you extract whole tree (e.g. bin, lib directories etc) or just node.exe from the .7z archive I provide?
3) Are you running shell.cmd or a plain windows prompt from start menu or by running cmd.exe ? (all three ways are supported)