cloud_package.cspkg file was not created after installing "socket.io-servicebus" - node.js

I'd like to use the "socket.io-servicebus" module to my node.js application.
But I encountered that a problem.
After installing the "socket.io-servicebus", cloud_package.cspkg file was not created by "Publish-AzureServiceProject" command.
I'm using "Windows Azure PowerShell" on Windows7 64bit edition.
Here is the procedure.
New-AzureServiceProject test1
Add-AzureNodeWebRole www
cd www
npm install socket.io-servicebus
Publish-AzureServiceProject -ServiceName xxx ...
[ cloud_package.cspkg will not created ]
By the way "Start-AzureEmulator -Launch" will be succeeded and we can test own application.
Please give me some advices. thank you.

It looks like the issue here is due to a known path length limitation. Azure has a limitation on paths in the package being more than 255 chars and in this case bringing in socket.io WITH all of it's dependencies is hitting that path.
There are several possible work arounds here.
A. - Zip up node modules and extract on the server.
Basically you zip up your modules and publish the module zip within the package. Then you can use an Azure startup task (in your cscfg) on the server to unzip the files.
Publish-AzureServicePackage will grab anything in the project, so in this case you just have a little script that you run before publishing which creates the node_modules archive and deletes node_modules.
I am planning to do a blog post on this, but it is actually relatively easy to do.
B. - Download node modules dynamically
You can download modules in the cloud. This can also be done with a startup task as is shown here.
If you look in that post you will see how you can author a startup task if you decide to do the archive route.
Feel free to ping me with any questions.

Related

Node cli script packaged with pkg in github actions giving Trojan:Script/Wacatac.B!ml detected

I have built a node CLI script and using github actions to make a exe file using node pkg module. The intent is that people can download a zip file and extract the exe and run the cli on their machine without going thru the complexities of manually installing node and running npm steps.
the build goes fine and the exe file gets zipped and released as an asset. I tried downloading the zip to test on my machine, but windows defender is throwing complaints about Trojan:Script/Wacatac.B!ml malware detected and quarantining the download. Of course that would scare people who would like to use the CLI exe.
The github release URL https://github.com/kkibria/slideshow-dist/releases/tag/v0.1.0-987630f.
The pkg configuration in package.json,
"pkg": {
...
"targets": [
...
"node16-win-x64"
...
],
...
}
I am not sure what is going on, trying to figure out the root cause. Any help will be highly appreciated. If anyone have seen this before and figured out, what steps would help my situation?
Update: This is most probably not a pkg problem. I extracted the file and ran virus scan on it. The scan was negative. Most likely if a zip file is downloaded and and it has a exe in it and the exe has certain pattern in it the scan gives a positive result. I am still not sure what causes it. Still would like to know if anyone can recommend a workaround.

Missing module "aws-exports" among other Amplify and AWS files

I was sent a "trial project" by a company looking to hire. It's a simple project but uses Amplify and AWS. The CTO told me I need to have a certain version of Node (10.18.1 or 10.19.0) and that I should run yarn install and everything will be good to go. So I completely uninstalled Node, installed NVM and the version of node I'm supposed to use. Then I opened the project and ran yarn install.
When I open the project in browser I am apparently a module, ./aws-exports, among other files that seem to be related to Amplify and AWS. I've noticed that most of these files are in the gitignore. But again, the CTO told me that I shouldn't have to do any setup.
I've tried installing with Npm instead. Using different versions of node. All sorts of silly little fixes and I'm just totally lost.
The file ./aws-exports will be created after the initialisation of Amplify
(https://aws-amplify.github.io/docs/cli-toolchain/quickstart?sdk=js#the-init-process)
It is in .gitignore because it contains configurations information of the AWS account, which you have configured in your terminal.
Does the project have a README? If so, read that. If not, don't work there.
Google the missing package name. If you find nothing, it is likely a private package.
A quick Google search gets me this: https://bit.dev/bondz/react-epic-spinners/orbit-spinner
And this: https://docs.bit.dev/docs/installing-components#configuring-bit-registry
Use Google.

Why does VS 2017 set node_modules folder to read only in .Net Core App?

I'm building a .Net Core application using Angular for my client-side code. For the most part, I'm using the default template that is included in VS 2017. For whatever reason, VS is making my node_modules folder read only. Before I was able to install packages via command line in the directory that holds my client side code as well as my package.json file and my node_modules folder. Before I was able to do this, but now it is defaulting the folder to read only which is invaliding all of my npm commands. I've verified that this is the case because I can remove the read only attribute via windows explorer and then run any of my commands like npm install.
Has anyone else encountered this before? If so, what did you do to resolve this?
Thanks!
Okay, I found the answer. VS puts a lock on the node_modules folder while it is running.
So, I guess for now if you need to add packages just close VS first.

NPM errors and control in Azure Websites

I want to build my Node.JS application in a Azure Website.
There will be an usage of different NPM packages via my packages.json file.
My problem is that I often receive error messages which are related to missing NPM files.
Normally I put my files via FTP or edit them per VS Studio 15 Azure plugin directly on the server. This may be the reason why NPM isn't triggering as Microsoft intended it.
I would prefer a way in which I can just run commands with elevated privileges to have full control over NPM by myself.
Which ways are possible to avaid these problems?
If you're publishing your nodeJS application 'manually' via FTP there are little concerns about that.
First of All, 'manually' means manually.
Git
If you use continuous deployment via Git the final deployment step is to call npm install in your current application folder, this will install all the packages listed in package.json file.
The node_modules folder is excluded by default in .gitignore file, so all packages are downloaded by the server
Web deployment
If you're using web deployment from visual studio or command line, all the files contained by your solution are copied to Hosting environment including node_modules folder , because of this the deployment would take a long time to finish due the huge amount of dependencies and files that the folder contains.
Even worst: this scenario could take you to the same scenario you're facing right now.
FTP deployment
You're copying everything yourself. So the same thing occurs in Web Deployment is happen in FTP deployment method.
--
The thing is that when you copy all those node_modules folder contents you're assuming that those dependencies remains the same in the target enviroment, most of the cases that's true, but not always.
Some dependencies are platform dependent so maybe in you're dev environment a dependency works ok in x86 architectures but what if your target machine or website (or some mix between them) is x64 (real case I already suffer it).
Other related issues could happen. May be your direct dependencies doesn't have the problem but the linked dependencies to them could have it.
So always is strongly recommended to run npm install in your target environment and avoid to copy the dependencies directly from your dev environment.
In that way you need to copy on your target environment the folder structure excluding node_modules folder. And then when files are copied you need to run npm install on the server.
To achieve that you could go to
yoursitename.scm.azurewebsites.net
There you can goto "Debug Console" Tab, then goto this directory D:\home\site\wwwroot> and run
npm install
After that the packages and dependencies are downloaded for the server/website architecture.
Hope this helps.
Azure tweak the Kudu output settings, in local Kudu implementations looks the output is normalized.
A workaround -non perfect- could be this
npm install --dd
Or even more detailed
npm install --ddd
The most related answer from Microsoft itself is this
Using Node.js Modules with Azure applications
Regarding control via a console with elevated privileges there is the way of using the Kudu console. But the error output is quite weird. It's kind of putting blindly commands in the console without much feedback.
Maybe this is a way to go. But I didn't tried this yet.
Regarding deployment it looks like that Azure wants you to prefer Continuous Deployment.
The suggested way is this here.

Getting started with nightwatch.js

Can anyone provide me with a detailed explanation on how to setup nightwatch and start writing browser tests? I have searched for such information online and was unable to find it. The nightwatch.js website had good information about various nightwatch command line commands, but not about actually setting up a nightwatch project, which is what I am having trouble with.
Specifically, I do not have a good understanding of the various files that come with installation of nightwatch, and how I am supposed to use them.
Step-by-Step Beginner's Tutorial
We needed an up-to-date, well-researched and maintained tutorial for Nightwatch for our team so we wrote one: https://github.com/dwyl/learn-nightwatch
We (highly) recommend using a nightwatch.conf.js (.js) file for configuring Nightwatch because (unlike a .json file) it allows you leave in-line comments to your fellow developers (i.e avoid "WTF" moments by communicating) and to evolve your configuration with variables & functions as needed.
Also, we prefer to install Nightwatch (and its required dependencies) locally so it's clear to everyone exactly what is required to run the project and which versions we are using.
Using the selenium-download module will download the latest versions of Selenium Standalone Server and Chromedriver (both required to run a basic Nightwatch test) for your OS and means you will be up-and-running much faster.
Rather than including the whole tutorial here we invite you to Star/Fork it on GitHub: https://github.com/dwyl/learn-nightwatch#step-by-step-tutorial
Feedback / questions / updates / improvements are always welcome!
You need basiclly two things:
The nightwatch.json file in the root of your project
And nightwatch installed (npm install -g nightwatch).
After that you use it on the command line as described in the documentation here and it will automatically grab your nightwatch.json file and run your tests based on the default test_setting.
I opened up an issue to add a nightwatch init command, so the setup of the nightwatch.json file is easier.
Further reading
How to setup nightwatch.json
Github Repository
You can go through this step-by-step method to get better understanding
Nightwatch.js Part 1
Nightwatch.js Part 2
one big problem for users "is not worked on count 1-2-3".
so we find many-many-many times our all internet :)
and.
1) nightwatch is installed (by .rpm, .deb, npm, downloaded). is haven't questions
2) is worked by execution "nightwatch" on CLI
3) but where wunderbar example?????????????
of course, on internet!
4) by my bad memory and catalog list in simple test:
- create catalog
- create in catalog 2 dirs:
bin for web-drivers (add chromedriver, selenium-server-standalone as minimum)
tests for tests
5) we need this simple config - nightwatch.json in catalog (use any simple which access have)
6) create-copy-paste any simple test in test catalog (it's one on planet :)
7)it's all, run in catalog by CLI: nightwatch
you need only this? for first time, before documentation readings? ;)
$ npm install -g yo
$ npm install -g generator-selenium-nightwatch
$ yo selenium-nightwatch
$ npm install
$ npm test

Resources