run node in gvim :ReferenceError: range is not defined [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
My system : xp + gvim+node.js
I have open gvim to edit a javascript sentence ,the file has no name yet.
print(sum(range(1, 10)));
when i input
:w !node
I get the error outputs :
C:\WINDOWS\system32\cmd.exe /c ( node ^<C:\DOCUME~1\sanya\LOCALS~1\Temp\VIi8C.tmp)
print(sum(range(1, 10)));
^
ReferenceError: range is not defined
at [stdin]:1:11
at Object.<anonymous> ([stdin]-wrapper:6:22)
at Module._compile (module.js:456:26)
at evalScript (node.js:532:25)
at ReadStream.<anonymous> (node.js:154:11)
at ReadStream.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)
shell returned 8
Hit any key to close this window...
How can i fix the error?
when i change the print(sum(range(1, 10))); into print("hallo world"); in gvim ,and input w ! node,i got the same output?
why in javasript window in eloquentjavascript.net/chapter1.html ,i can get right answer?

You must define the "range", "sum", and "print" functions.
Once you do that your JavaScript code will be executable by the node interpreter.
Also, the use of gvim is irrelevant here. Running that code from the command line will have the same results.

Related

Error in backblaze b2 axiosRetry is not a function [duplicate]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 15 hours ago.
Improve this question
I am working on a next js 13 application in which I am making an image upload service through the formidable package and the backblaze b2 object storage service, I get this error after starting my application in next js, it worked fine but I've been getting this error for a while now, I've already tried uninstalling the node modules and installing the latest versions of the npm dependencies.
error stacktrace
Critical dependency: the request of a dependency is an expression
Import trace for requested module:
./node_modules/formidable/src/Formidable.js
./node_modules/formidable/src/index.js
./controllers/uploadController.js
./controllers/productController.js
./app/page.jsx
warn - Fast Refresh had to perform a full reload due to a runtime error.
error - node_modules\backblaze-b2\lib\b2.js (24:4) # axiosRetry
error - TypeError: axiosRetry is not a function
at new B2 (webpack-internal:///(sc_server)/./node_modules/backblaze-b2/lib/b2.js:22:8)
at eval (webpack-internal:///(sc_server)/./lib/storageB2.js:8:18)
at (sc_server)/./lib/storageB2.js (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\app\page.js:1005:1)
at __webpack_require__ (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(sc_server)/./controllers/uploadController.js:5:72)
at (sc_server)/./controllers/uploadController.js (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\app\page.js:983:1)
at __webpack_require__ (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\webpack-runtime.js:33:43)
at eval (webpack-internal:///(sc_server)/./controllers/productController.js:9:75)
at (sc_server)/./controllers/productController.js (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\app\page.js:972:1)
at __webpack_require__ (C:\Users\fxliv\OneDrive\Escritorio\tuganga\.next\server\webpack-runtime.js:33:43) {
type: 'TypeError',
page: '/'
}
null
I need someone to help me to continue working on my project, thanks!!

Cannot be loaded because running scripts is disabled on this system -- ANGULAR V14 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 months ago.
Improve this question
When I have to run my Angular project or any ng command, the system shows the below error:
ng : File C:\Users\achra\AppData\Roaming\npm\ng.ps1 cannot be loaded
because running scripts is disabled on this system. For more
information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1
ng v
~~
CategoryInfo : SecurityError: (:) [], PSSecurityException
FullyQualifiedErrorId : UnauthorizedAccess
Any Solution... I'm new on Angular and i have just started to learn !
Thanks for your attention. I’m looking forward to your answers.
First, you have to need to open the command prompt and run this command.
set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Now you have to run the second command on your system. This command is:
Get-ExecutionPolicy
When you have run this command your system has a show “RemoteSigned”. If you have received this message, then your problem will be solved. Now you have to go to the next step to view the list of policy which policy has been updated by the last commands.
To view their policy, you need to run this command in your command prompt:
Get-ExecutionPolicy -list
When you run this command, a few policies are shown on your monitor screen.
Now you can see your system execution policy list. You have successfully solved your problem. Now you need to go to the command prompt and check that your problem is solved.

I am trying to create a React Native App with vs code but I have some errors [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 12 months ago.
Improve this question
So this type of the error. How to solve this
Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:135:10)
at stableHash (/home/shavkat/Android/AwesomeProject/node_modules/metro-cache/src/stableHash.js:19:8)
at Object.getCacheKey (/home/shavkat/Android/AwesomeProject/node_modules/metro-transform-worker/src/index.js:593:7)
at getTransformCacheKey (/home/shavkat/Android/AwesomeProject/node_modules/metro/src/DeltaBundler/getTransformCacheKey.js:24:19)
at new Transformer (/home/shavkat/Android/AwesomeProject/node_modules/metro/src/DeltaBundler/Transformer.js:48:9)
at /home/shavkat/Android/AwesomeProject/node_modules/metro/src/Bundler.js:22:29 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
The problem is with your node version.
try this solution on github and it should work for you.
Here is two option now -
Try to uninstall Node.js version 17+ and reinstall the Node.js version 16+
Open terminal and paste these as described :
Linux & Mac OS (windows git bash)-
export NODE_OPTIONS=--openssl-legacy-provider
Windows command prompt-
set NODE_OPTIONS=--openssl-legacy-provider
Reference Link

I'm trying to do something about firebase realtime database but I get an exports error [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last year.
Improve this question
I'm trying to do something about firebase realtime database, but I'm getting such an error can you help?
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in C:\Users\efeba\Desktop\test2\node_modules\firebase\package.json
at throwExportsNotFound (internal/modules/esm/resolve.js:299:9)
at packageExportsResolve (internal/modules/esm/resolve.js:522:3)
at resolveExports (internal/modules/cjs/loader.js:449:36)
at Function.Module._findPath (internal/modules/cjs/loader.js:489:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:875:27)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (C:\Users\efeba\Desktop\test2\app.js:1:16)
at Module._compile (internal/modules/cjs/loader.js:1072:14) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
The Firebase js sdk is for client-side use only. In order to interact with Firebase from your backend environment (ie cloud functions, node backend, etc), you must use the admin-sdk.
Keep in mind that since the admin-sdk runs in a secure, trusted environment, it has elevated privileges and will bypass security rules, so make sure you're validating your data in your functions.
You can view the full documentation for the admin-sdk here: (Firebase Admin SDK)

Karma in IntelliJ: Test framework quit unexpectedly [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
Searched for this error and nothing useful, so posting here.
I have a unit test for my Angular app and when I run it or debug it, it completes successfully. When I run code coverage, I get
13 11 2019 13:01:48.249:ERROR [karma-server]: TypeError: Cannot read property 'indexOf' of undefined
at Object.exports.arrayRemove (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\helper.js:109:26)
at _reporters.forEach (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:15:50)
at Array.forEach (<anonymous>)
at MultiReporter.removeAdapter (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:15:21)
at C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijReporter.js:83:25
at Array.forEach (<anonymous>)
at C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijReporter.js:81:33
at process._tickCallback (internal/process/next_tick.js:61:11)
13 11 2019 13:01:48.626:ERROR [karma-server]: TypeError: Cannot read property 'push' of undefined
at _reporters.forEach (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:11:61)
at Array.forEach (<anonymous>)
at MultiReporter.addAdapter (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\reporters\multi.js:11:21)
at Server.<anonymous> (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\middleware\runner.js:41:18)
at Object.onceWrapper (events.js:277:13)
at Server.emit (events.js:194:15)
at Executor.schedule (C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\executor.js:30:20)
at C:\casenet\sources\provider-portal\portal-client\node_modules\karma\lib\middleware\runner.js:92:22
at tryCatcher (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:729:18)
at Promise._fulfill (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:673:18)
at Promise._resolveCallback (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:466:57)
at Promise._settlePromiseFromHandler (C:\casenet\sources\provider-portal\portal-client\node_modules\bluebird\js\release\promise.js:559:17)
Cannot read property 'success' of undefined
TypeError: Cannot read property 'success' of undefined
at TestCommand.runSingleTarget (C:\casenet\sources\provider-portal\portal-client\node_modules\#angular\cli\models\packages\angular\cli\models\architect-command.ts:242:21)
In addition, I get this in the Test Run window:
"C:\Program Files\nodejs\node.exe" C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijRunner.js --serverPort=9876 --protocol=http: --urlRoot=/ "--testName=^COMPONENT/CLIENT -> DynamicInputComponent "
C:\Users\thehl\.IntelliJIdea2019.2\config\plugins\js-karma\js_reporter\karma-intellij\lib\intellijRunner.js:60
throw e;
^
Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:111:27)
I tried a full reboot and upgrading everything that said karma to the current version.
Have no idea where to even start debugging this.
Problem was caused by a recent change using karma-parallel. We broke up our unit tests to run in 4 separate threads with 4 separate web browsers.
I pulled all the references and definitions for karma-parallel from the package.json and from karma.conf.js. Unit tests work fine now within IntelliJ.
I'm simply going to have to roll this back every time I want to do this from now on.

Categories