Error starting a test with testacular - javascript

I am trying out the angularjs tutorials on a 64 bit Windows 7 system because I find this framework quite interesting from what I read on its home page. I am a newbie to node.js and not experienced in Java-Script.
When running the tests, I get the following error. Can anybody find out what the problem is or give some hints how to determine that? I have a fresh Installation of node and added testacular with
npm install -g testacular
which worked fine from what was printed on the console window.
So here is the error message:
PS C:\Users\xx\Documents\Angular\angular-phonecat> .\scripts\test.bat
INFO [testacular]: Testacular server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
ERROR [testacular]: { [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }
Error: spawn ENOENT
at errnoException (child_process.js:948:11)
at Process.ChildProcess._handle.onexit (child_process.js:739:34)

Short answer:
Set env variable CHROME_BIN to full path to chrome.exe
The error msg is confusing, as the behavior of spawn got changed in Node 0.10, we need to update it (https://github.com/karma-runner/karma/issues/452)

Inserting 'PhantomJS' for the test browser in the karma configuration file on Windows Vista resulted in the same error message: { [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }
I ad-libbed on the advice above and inserted in the system path ("Environmental Variables") under "User variables for owner" PHANTOMJS_BIN with the value consisting of the path including phantomjs.exe (C:\Program Files\phantomjs-1.9.0-windows\phantomjs.exe)
All good, jasmine angularjs tests running now and much faster than with 'Chrome' or 'Firefox' as the test browser.

Related

How to run "vue ui" with Node.js v17.2.0?

I need to use "vue ui" in my project but resently I have update node 14 to Node.js v17.2.0 and now I can't open Vue GUI. Still Ihave a problem:
at Object.readdirSync (node:fs:1390:3)
at exports.readdir (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/sync/fs.js:18:20)
at Object.safeCall [as safe] (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/call.js:24:8)
at DirectoryReader.readNextDirectory (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/directory-reader.js:78:10)
at Readable.DirectoryReader.stream._read (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/directory-reader.js:57:18)
at Readable.read (node:internal/streams/readable:496:27)
at readdirSync (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/sync/index.js:27:21)
at Function.readdirSyncStat (/usr/local/lib/node_modules/#vue/cli/node_modules/#mrmlnc/readdir-enhanced/lib/index.js:34:10)
at ReaderSync.dynamicApi (/usr/local/lib/node_modules/#vue/cli/node_modules/fast-glob/out/providers/reader-sync.js:64:24)
at ReaderSync.api (/usr/local/lib/node_modules/#vue/cli/node_modules/fast-glob/out/providers/reader-sync.js:56:25)
Emitted 'error' event on Readable instance at:
at emitErrorNT (node:internal/streams/destroy:164:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
syscall: 'scandir',
code: 'ENOENT',
path: '/Users/ewakadziolka/Desktop/vue/emmaus/node_modules/#vue/cli-service/locales'
}
directory that coud be founded is my lastest projest that I used Vue GUI with node 14 yet not new one where I want to use Vue GUI.
Do you have any solution?
Thanks
I've decided to install node v16.13.1 and now all works very well. I have my vue GUI opened on localhost 8000.

"spawn C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell ENOENT" error while running npm start

When ever I try to execute npm start, this is what happens. I think there is some issue with powershell and not with npm because npm starts the development server. BTW I created basic react app using npx create-react-app. I checked, powershell file is there in the specified location and it is working as well. Guild me what should I do in order to resolve the error.
events.js:353
throw er; // Unhandled 'error' event
^
Error: spawn C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell',
path: 'C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
'UwB0AGEAcgB0ACAAIgBoAHQAdABwADoALwAvAGwAbwBjAGEAbABoAG8AcwB0ADoAMwAwADAAMAAiAA=='
]
}
I faced with a same problem on Windows 10.
And solution was a pretty simple - just run your commands in git bush console.
Step 1:(reason of the error)
go to C:\Windows\System32\WindowsPowerShell\v1.0 and then you will not be found powershell.exe file that folder.
Step 2: (solution of the error)
download powershell.exe file online or just copy and paste this file in C:\Windows\System32\WindowsPowerShell\v1.0
https://www.exefiles.com/en/exe/powershell-exe/ - To download powershell.exe file online
So after trying everything and looking for the error on every possible website. I still wasn't able to resolve the error. Then I personally talked to someone regarding the error and he suggested me to run it in Windows Sub-system for Linux (WSL). I exactly did that and installed WSL with Linux 20.04 LTS. Now I am using Unix terminal to create the react app. It isn't the best solution for the problem, but yeah it does work and saves a lot of time!

How to manage stuck jobs in Kue?

I'm using Kue to create jobs for my MEAN.js app. If the application is idle for some time the Redis connection is closed, apparently Kue is trying to process jobs while the connection is closed, and I get some errors.
I'm watching for stuck jobs every 6 seconds, but this doesn't seem to help avoid the errors.
app.jobs.watchStuckJobs(1000 * 6);
These are the errors I'm getting, for each job I'm processing, after the connection is closed and before the connection is restored:
ERROR: { [Error: Redis connection to XXX failed - read ETIMEDOUT] code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' }
ERROR: { [AbortError: Redis connection lost and command aborted. It might have been processed.]
code: 'UNCERTAIN_STATE',
command: 'BLPOP',
args: [ 'q:send-email-invitations:jobs', 0 ],
origin: { [Error: Redis connection to XXX failed - read ETIMEDOUT] code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'read' } }
I've been reading the Kue documentation for stuck jobs, but the solution they recommend is using Domains, which for the Node version I'm using is deprecated; using promises or binding the error to uncaughtException, which will lose the error context.
What's the best approach in this case, so I don't lose the error context, and I can trace what's happening with the jobs?
If I have to choose one of these options, which is the best I can choose and why?
Is there any Redis configuration or anything outside Kue that I need to be aware of?

npm fails on windows 10 insider preview build 14366

It seems that npm is broken (as well as the nodejs itself) on the new windows version build 1433
This is what happens when I ran
npm -v
events.js:141
throw er; // Unhandled 'error' event
^
Error: This socket is closed.
at WriteStream.Socket._writeGeneric (net.js:640:19)
at WriteStream.Socket._write (net.js:694:8)
at doWrite (_stream_writable.js:292:12)
at writeOrBuffer (_stream_writable.js:278:5)
at WriteStream.Writable.write (_stream_writable.js:207:11)
at WriteStream.Socket.write (net.js:618:40)
at WriteStream.stream.write (C:\Program Files\nodejs\node_modules\npm\node_m
at Cursor.write (C:\Program Files\nodejs\node_modules\npm\node_modules\npmlo
at Cursor.(anonymous function) [as show] (C:\Program Files\nodejs\node_modul
at Object.ProgressBar.hide (C:\Program Files\nodejs\node_modules\npm\node_mo
3.9.5
I've tried npm upgrade, but does not help much.
Are there any hotfix solutions or why this could happen?
From what I can see this is a known issue with some version of Windows 10: https://github.com/npm/npm/issues/12887. I find the proposed solution a bit weird - that the issue is presented only when you change the width of the console away from the default. You might give it a try. As it doesn't sound very plausible I am adding the github comment where I found it: https://github.com/npm/npm/issues/12887#issuecomment-222525339
Also running the command prompt in legacy mode seems to be another workaround.

Issues installing MEAN stack

I have been trying to install the MEAN stack using the following tutorial:
http://www.bossable.com/303/install-mean-stack/#comment-1526
I am using webstorm and MongoDB.
However I have been unsuccessful and I keep getting errors. Everytime I connect to localhost:3000 I get the following error:
C:\meanproject>grunt
Running "jshint:all" (jshint) task
>> 55 files lint free.
Running "csslint:all" (csslint) task
>> 2 files lint free.
Running "concurrent:default" (concurrent) task
Running "nodemon:dev" (nodemon) task
Running "watch" task
Waiting...
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/views/**/*.* gruntfile.js server.js config/**/*.js app/*
*/*.js
[nodemon] starting `node --debug server.js`
Debugger listening on port 5858
Application loaded using the "development" environment configuration
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
MEAN.JS application started on port 3000
C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection
\base.js:246
throw message;
^
Error: Error setting TTL index on collection : sessions
at C:\meanproject\node_modules\connect-mongo\lib\connect-mongo.js:169:23
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\db.
js:1499:46
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\db.
js:1632:20
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\cur
sor.js:170:22
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\cur
sor.js:714:39
at Cursor.close (C:\meanproject\node_modules\mongoose\node_modules\mongodb\l
ib\mongodb\cursor.js:1009:5)
at commandHandler (C:\meanproject\node_modules\mongoose\node_modules\mongodb
\lib\mongodb\cursor.js:714:21)
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\db.
js:1905:9
at Server.Base._callHandler (C:\meanproject\node_modules\mongoose\node_modul
es\mongodb\lib\mongodb\connection\base.js:453:41)
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\con
nection\server.js:488:18
at MongoReply.parseBody (C:\meanproject\node_modules\mongoose\node_modules\m
ongodb\lib\mongodb\responses\mongo_reply.js:68:5)
at null.<anonymous> (C:\meanproject\node_modules\mongoose\node_modules\mongo
db\lib\mongodb\connection\server.js:446:20)
at emit (events.js:107:17)
at null.<anonymous> (C:\meanproject\node_modules\mongoose\node_modules\mongo
db\lib\mongodb\connection\connection_pool.js:207:13)
at emit (events.js:110:17)
at Socket.<anonymous> (C:\meanproject\node_modules\mongoose\node_modules\mon
godb\lib\mongodb\connection\connection.js:440:22)
[nodemon] app crashed - waiting for file changes before starting...
How would I go about solving this?
You need to run the mongodb.exe file first. After successfully starting mongodb, you need to navigate into your project folder and run 'grunt'. If it shows you a error list of modules not found, you need to install those modules globally with npm. That will solve the problem for you. However, please note that bossable.com tutorial is for 0.3 mean stack boiler plate. They have upgraded their version to 0.4.1 now. Follow the Meanjs documentation
for latest information.

Categories

Resources