Integrating Karma and webstorm - angularjs

I would like to integrate Karma and webstorm for windows, I have followed the steps from this web:
http://mobicon.tistory.com/273 (translate it to english) but does not work.
I have created one Karma Server and a Karma run:
In Path to Node Js File textfield, I have pointed to a karma file from the node-modules:
C:\Users\xxx\AppData\Roaming\npm-cache\karma\0.8.4\package\bin\karma
In the application parameters for the server start and for the Karma Run run
I get the following errors:
module.js:340
throw err;
^
Error: Cannot find module 'optimist'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (C:\Users\Javito\AppData\Roaming\npm-cache\karma\0.8.4\package\lib\cli.js:2:16)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
Process finished with exit code 1

The problem was the Karma execution file (Path to node App JS file) I was pointing to, here is my configuration for both server and run:
Karma Server:
Karma Run:

Trying to run sails app(app.js nodejs) in Webstorm gave me the optimist error in Ubuntu 14(32 bits). I fixed it by running:
sudo npm install optimist
Cheers!

Related

Discord.js bot broke

I read something about this error, but I have discord.js 13.6.0 and node 17.x.x
and I don't know what can couse it.
error:
Error: Cannot find module 'node:events'
Require stack:
- /home/runner/FittingAttachedHacks/node_modules/discord.js/src/client/BaseClient.js
- /home/runner/FittingAttachedHacks/node_modules/discord.js/src/index.js
- /home/runner/FittingAttachedHacks/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous>
(/home/runner/FittingAttachedHacks/node_modules/discord.js/src/client/BaseClient.js:3:22)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
looks like you have installed link, but not the actual node version v17. Try uninstalling wrong package v17.4.0 and install the right version from official site of node.js
The required node version for discord js v13 is node verson of v16 or higher, without it you'll get error like:
1.AbortController is not defined
2.Unexpected token '?'
3.cannot find module 'node:events'
The simple solution is just upgrade to node v16 and the error will be fixed!
Download Node from the website or NVM (Node Version Manager) if you're using Linux.
NVM link: https://github.com/nvm-sh/nvm

run Angularjs application fails

i try to run an angularjs applic, i understood that max version of node that can run it is 6.17.1
so i downloaded it using nvm, and then i run npm install but when i run npm start it failse and it looks like it downloade dependencis of higher versions that use es6 so thats why it fails.
i tried to downgrade specific libraries by deleting them from node modules and installing again specific lower version but when i tried npm show version it looks like its still use the higher version.
the error message is:
Failed to load external module #babel/register
[08:42:09] Requiring external module babel-register
C:\Users\s313240798\source\Workspaces\Nesher\Nesher\Nesher.Client\node_modules\micromatch\index.js:44
let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Module._extensions..js (module.js:586:10)
at Object.require.extensions.(anonymous function) [as .js] (C:\Users\s313240798\source\Workspaces\Nesher\Nesher\Nesher.Client\node_modules\babel-register\lib\node.js:152:7)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
i tried to run it also with higher version of node but then the app was on but faild because of th e Incompatibility of versions
This page has some suggestions which may help fix your issue: github.com/gulpjs/gulp/issues/1631
Have you tried this suggestion from the above web page?
npm i -S babel-register

create-react-app not working due to postcss

I am currently learning react, and started a new app with create-react-app.
I navigated into the new app, then ran npm start.
I got this error message:
Error: Cannot find module '~/Desktop/forms-test/node_modules/postcss-safe-parser/node_modules/postcss/lib/tokenize'
at createEsmNotFoundErr (internal/modules/cjs/loader.js:907:15)
at finalizeEsmResolution (internal/modules/cjs/loader.js:900:15)
at resolveExports (internal/modules/cjs/loader.js:432:14)
at Function.Module._findPath (internal/modules/cjs/loader.js:472:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (~/Desktop/forms-test/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
Any help would be very useful.
I am running Mac OS Catalina, using npm, and running zsh. I am using node version 14.13.1
For others digging around, I followed the instructions on this answer.
rm yarn.lock
yarn install
And that reinstalled everything and properly exported the lib/tokenize path inside of node_modules/postcss-safe-parser/node_modules/postcss/package.json.

ReactNative: Trying to debbug cannot find module

I'm trying to debug my app. In the past everything worked perfectly. Then I formatted the computer, downloaded the project I had saved from git.
At this point, every time I try to run npm start in the terminal or to use the react native tool of visual studio code to debug the app or in any case to update the app connected to my device I get this error:
Error: Cannot find module '/Users/..../node_modules/#react-native-community/cli/build/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:338:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:719:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1072:27)
at Function.Module._load (internal/modules/cjs/loader.js:928:27)
at Module.require (internal/modules/cjs/loader.js:1145:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> (/Users/.../node_modules/react-native/cli.js:12:11)
at Module._compile (internal/modules/cjs/loader.js:1256:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
at Module.load (internal/modules/cjs/loader.js:1105:32) {
code: 'MODULE_NOT_FOUND',
path: '/Users/..../node_modules/#react-native-community/cli/package.json',
requestPath: '#react-native-community/cli'
I don't understand how can I do.
I remember that before when I made a change to the code I just needed to run npm start to reload my project and see the changes in my device. Now I absolutely can't get the code and device to interact.
How can I do?
You try reinstall React LI:
npm install –g react-native-cli
and install dependences:
npm install

"No provider error" on Karma serve running angularjs phonecat tutorial

I have found and tried many solutions offered here and elsewhere: re downgrading karma version upgrading node and npm - changing order of load in the config file....
but so far nothing works. Is the problem that I am running the angular tutorial via Apache?
Starting Karma Server (http://karma-runner.github.io)
/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:9
throw error('No provider for "' + name + '"!');
^
Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)
at error (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:22:68)
at Object.parent.get (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:9:13)
at get (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:54:19)
at /usr/local/lib/node_modules/karma/lib/server.js:28:14
at Array.forEach (native)
at start (/usr/local/lib/node_modules/karma/lib/server.js:27:21)
at invoke (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:75:15)
at Object.exports.start (/usr/local/lib/node_modules/karma/lib/server.js:204:12)
at Object.<anonymous> (/usr/local/lib/node_modules/karma/bin/karma
/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:9
throw error('No provider for "' + name + '"!');
^
Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)
at error (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:22:68)
at Object.parent.get (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:9:13)
at get (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:54:19)
at /usr/local/lib/node_modules/karma/lib/server.js:28:14
at Array.forEach (native)
at start (/usr/local/lib/node_modules/karma/lib/server.js:27:21)
at invoke (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:75:15)
at Object.exports.start (/usr/local/lib/node_modules/karma/lib/server.js:204:12)
at Object.<anonymous> (/usr/local/lib/node_modules/karma/bin/karma:19:39)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
You have to install jasmine:
npm install -g karma-jasmine
The selected answer didn´t work for me, this is what it work for me:
https://github.com/karma-runner/karma/issues/880
Karma needs to load the plugins (such as karma-jasmine). By default
(if you don't specify config.plugins), Karma loads all the karma-*
modules that are siblings to Karma.
It sounds like you have Karma installed globally (npm install -g
karma) and jasmine plugin locally (npm install karma-jasmine). If
that's the case, install Karma locally.
The recomended way is to install Karma and all the plugins locally,
per project.
as per the documentation following plugins are required.
// these plugins will be require() by Karma
'karma-jasmine',
'karma-chrome-launcher'
So add these two to your plugin section.
I don't know what platform/os/version you're on, but for me, on mac os x 10.9 ("Mavericks"), I was running into the exact same issue with trying to run karma on an e2e test with the simple angular docs tutorial in their step 3. I solved it in a pretty silly/dumb way =>
Closed the terminal/shell window in which I had all these problems
Re-opened a new terminal/shell window
Ran everything with sudo in front
It all installed/worked, including... npm install -g.
so there you go.

Resources