No Entry Error when trying to install Karma js - node.js

I'm super new to all of these frameworks. I'm following tutorials that want me to use Karma for unit testing. According to NPMjs.org - karma The build is failing
Is this ENOENT error:
after running npm install -g karma
a result of this failing build? Or is it windows? Maybe a system enviroment variable error.
Are there prerequisite npm modules I must install before karma will properly install?
I'm uncertain on where to start debugging this problem.

Karma depends on ws: this is this package that npm can't build.
It builds fine on Mac Os but doesn't on Windows: there's an issue on karma's GitHub referring to ws' github issues (here, here and there). I'd suggest you to take a look a the possible solutions, but unfortunately it doesn't look like this is a resolved matter.

Related

npm install as a build step in TeamCity

I am studying a TeamCity project which has to do with a .NET application with Angular at the frontend. What it does not make sense to me is I cannot find anywhere npm install. For example:
The thing is in case I add a dependency in package.json which requires update of node_modules folder, everything works fine as far as the artifacts are concerned and Angular finds the files it needs!!
But how node_modules folder on TeamCity is updated?
Sorry, for being a little bit abstract; honestly, I cannot find npm install anywhere.
I would highly recommend looking at the TeamCity Node Plugin available at https://github.com/jonnyzzz/TeamCity.Node. The plugin, which is also available via the TeamCity Plugin repository for an integrated installer, will allow you to use NVM to install a specific version of Node as well as run NPM to install other dependencies, etc.
I hope this helps!

How to build a node module?

I thought this would be trivial and I realise that it may differ from project to project, but I tried to reproduce the node module build for webdriverio locally and use that in my project.
Here's what I tried:
git clone git#github.com:webdriverio/webdriverio.git
cd webdriverio
git checkout v4.8.0
npm install
npm run build
npm pack
This produces a file named webdriverio-4.8.0.tgz. I change the package.json file of my project to depend on this file rather than webdriverio from npm. Like so:
"webdriverio": "file:../webdriverio/webdriverio-4.8.0.tgz",
Running npm install in my project, updates webdriverio in node_modules as expected, except my version is different from the npm version, despite presumably being based on the same code.
I've never built a node module before, so I appreciate that I might have missed something, but the resources I've found online seem to indicate that the above should be enough. Also if there is a better way to accomplish what I'm trying to accomplish, I'd appreciate the feedback.

Webpack Binding Issue

Hey guys for some reason I keep getting this error when building with sass-loader
Module build failed: Error: Missing binding C:\TFS_Local\DPOnGit\node_modules\node-sass\vendor\win32-ia32-11\binding.node
Node Sass could not find a binding for your current environment: Windows 32-bit with Node 0.10.x
Found bindings for the following environments:
- Windows 64-bit with Node.js 5.x
This usually happens because your environment has changed since running npm install.
Run npm rebuild node-sass to build the binding for your current environment.
Very frustrating as this config has worked on the same machine before without issues.
I had the same problem, rebuilding as suggested by the error message didn't work for me, but running
npm install --save sass-loader
did.

NPM Experts! Does NPM need to be installed with every JointsWP Gulp Sass project

I'm using JointsWP (an excellent Foundation 6 port to Wordpress).
I'm using the Sass version and it's working great. However, I seem to have to install npm with every project. Is this nessesary?
Is there a way to install npm globally and link to it from my project? Or have the project find it automatically?
I think you are confused about what the command npm install actually does. npm install installs all the npm dependencies for your project into the node_modules directory. It doesn't actually install npm. To run npm install you have to have Node.js installed (npm is included with node).
So to answer your question, yes it is necessary to run npm install for every project.
Relevant Article: Global vs Local installation
The article above shared by Colin Marshall is great and sums up the answer perfectly.
In general, the rule of thumb is:
If you’re installing something that you want to use in your program,
using require('whatever'), then install it locally, at the root of
your project. If you’re installing something that you want to use in
your shell, on the command line or something, install it globally, so
that its binaries end up in your PATH environment variable.
So to answer your question, is it possible? Yes.
Is it recommended? No.
https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/
You can install gulp sass globally with the command:
npm install -g gulp-sass

Karma - config file does not exist

Hi I'm trying to go through the AngularJS original tutorial and in step 2 where I'm supposed to run ./scripts/test.sh, I get an error saying
[ERROR] config - Config file does not exist!
I've checked /config/karma.conf.js and the file indeed does exist.
I'm running the latest version of node, npm, and karma.
I thought re-installing them would fix the issue (as mentioned by a member of the AngularJS team on a Google forum post I found).
I still get the error however. Anyone have any suggestions?
Edit: I tried running /config/karma.conf.js and it gave an error saying "JASMINE is undefined," even though Jasmine is installed. Do I have to set a path or something? I have jasmine installed globally.
You might need to install Karma
steps:
npm install generator-karma
yo karma
If you are on windows try to run ./scripts/test.bat.
On Mac OS Mavericks.
1 - Install Karma
npm install -g generator-karma
2 - run yo karma
yo karma
If node.js and yo is working this will be enough.

Resources