I am trying to run a node package.
Technically, I can simply do ./node_modules/.bin/<package name> from my project's root folder, or even npx <package name> from any folder.
But I need to run node with a specific configuration of max-old-space-size set to 4096.
I am therefore trying to invoke it as follows:
node --max-old-space-size=4096 ./node_modules/.bin/<package name>
Which gives me the following error:
<root folder>\node_modules\.bin\<package name>:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
I am pretty sure that this problem is due to the fact that I am running on Windows.
I did some research and came across this GitHub thread, which makes me even more confident that the problem is OS-related.
But I haven't been quite able to find a workable solution within this thread.
The only clue that I have found is by sc0ttwad3 from 12 days ago, suggesting to change this:
./node_modules/.bin/<package name>
To this:
./node_modules/<package name>/bin/<package name>.js
But there is no such js file in this path (in fact, there is not even a bin folder in this path).
Can anyone shed some light on this?
Related
Sourcetree starting throwing error as below after having nvm setup with multiple versions of node. Sourcetree unable to find the exact nodepath.
How to set default nodePath to target for Sourcetree?
Info: can't find node in PATH, trying to find a node binary on your system
/Users/project-ui/node_modules/husky/run.js:8
message(requiredVersion) {
^
SyntaxError: Unexpected token (
at Module._compile (module.js:439:25)
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:929:3
Completed successfully
I managed with couple of steps
which node: /Users/xyz/.nvm/versions/node/v12.18.2/bin/node
I included that to path variable inside bash_profile:
export PATH="/Users/xyz/.nvm/versions/node/v12.18.2/bin:$PATH"
Worked like charm
I have followed this (https://medium.com/coinmonks/build-a-insurance-application-with-hyperledger-composer-and-react-js-part-1-3ebe7ad54986) tutorial upto "create our REST API".
Now when i run following command
composer-rest-server -c admin#secure-phi -n never -u true -w true
I get following error
/home/ali/.nvm/versions/node/v8.17.0/lib/node_modules/composer-rest-server/node_modules/formdata-node/lib/FormData.js:206
async *__getField() {
^
SyntaxError: Unexpected token *
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/home/ali/.nvm/versions/node/v8.17.0/lib/node_modules/composer-rest-server/node_modules/#tim-lai/isomorphic-form-data/lib/index.js:2:18)
Is this a syntax related error or something else, and any way to fix this?
I found the error is related to generator not supported below node v8, but hyper-ledger-composer specifically requires node v8, so any work around to this?
It seems to be a version conflict between sub-dependencies in the graph.
Looks like the package 'g11n-pipeline' is requiring a different version of 'swagger-client' that pulls the dependency '#tim-lai/isomorphic-form-data'.
I did this workaround as it is a global package (we don't have access to the package-lock.json/package.json).
Since you've installed with NPM (npm i -g composer-rest-server):
cd /home/ali/.nvm/versions/node/v8.17.0/lib/node_modules/composer-rest-server
npm install swagger-client#3.9.0
rm -rf node_modules/g11n-pipeline/node_modules/swagger-client
I've brought up a Kafka-based ordering service in the Fabcar network by modifying some docker composition/configuration files, which is one of the tutorials on Hyperledger Fabric readthedocs.
These are the issues I've suffered from. Could you please tell me how to resolve them or even one of them?
I'd like to have containers start up in a specific order with 'wait-for-it.sh' script so that the orderer starts trying to connect to the Kafka cluster right after it is ready to perform commands. Do you happen to know how I should apply the script to my docker composition file?
When I executed "enrollAdmin.js" file in order to register an admin account with node enrollAdmin.js on the network in the same way as I did on the unmodified network,
This error message is shown and it doesn't work:
~/fabric-samples/fabcar/node_nodules/fabric-
client/lib/Client.js:746
async _createOrUpdateChannel(request, have_envelop) {
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected Identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/~/fabric-samples/fabcar/node_modules/fabric-client/index.js:25:18)
at Module._compile (module.js:570:32)
I took a look at Client.js file and was trying to understand how it works, but I have no idea what it is for and why it causes the issue.
Please help me resolve this issue if you know how.
Update Your nodejs .
check node version
node -v
It shoulb be greater than 8.0.0.
As the title says, I formatted my linux partition where I used as web development environment. Mainly I used MongoDB and NodeJS and both of them are installed correctly. But when I try to execute my main.js I get an error log. It must be something extremely silly that I'm not reminded of. Any help is appreciated. Error log:
SyntaxError: Invalid or unexpected token
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
Note that helpers.js is a node internal module.
Please download nodeJS command prompt for Linux or download by command
pacman -S nodejs npm
For More help : Visit the link
Node JS Installation Guide
I have been following the instructions to install Mocha with WebStorm found here: https://www.jetbrains.com/help/webstorm/2017.1/testing-javascript-with-mocha.html#d194239e92
I have set the configurations to run files that match the pattern: **/*.spec.js
node interpreter: /usr/bin/node
working directory:/home/web/app
mocha package:/home/web/app/node_modules/mocha
I am writing in TypeScript which is converted to ES6, the output of which is what I'm attempting to test. However I get this error which I don't understand and so don't really know where to begin looking to resolve.
I don't understand why it is looking for "ts-node", considering it's only supposed to look for "spec.js" files. and past that, I don't understand why the folder it is looking for in ts-node is missing. I have uninstalled then re-installed ts-node a couple times, neither of which yielded the sought after folder... I have no clue as to how to proceed or even what further information is needed to help resolve this issue.
Any help would be appreciated. I just want to test my application and this is proving to be a real headache.
Here is the error:
/usr/bin/node /home/web/app/node_modules/mocha/bin/_mocha --ui bdd
--reporter /opt/webstorm/ws/plugins/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js
**/*.spec.js TypeError: The specified path does not exist: /home/web/app/node_modules/ts-node/tests
at resolveSync (/home/web/app/node_modules/ts-node/node_modules/tsconfig/src/tsconfig.ts:72:9)
at Object.loadSync (/home/web/app/node_modules/ts-node/node_modules/tsconfig/src/tsconfig.ts:140:16)
at readConfig (/home/web/app/node_modules/ts-node/src/index.ts:418:18)
at Object.register (/home/web/app/node_modules/ts-node/src/index.ts:176:18)
at Suite. (/home/web/app/node_modules/ts-node/src/index.spec.ts:190:5)
at Object.create (/home/web/app/node_modules/mocha/lib/interfaces/common.js:114:19)
at context.describe.context.context (/home/web/app/node_modules/mocha/lib/interfaces/bdd.js:44:27)
at Suite. (/home/web/app/node_modules/ts-node/src/index.spec.ts:189:3)
at Object.create (/home/web/app/node_modules/mocha/lib/interfaces/common.js:114:19)
at context.describe.context.context (/home/web/app/node_modules/mocha/lib/interfaces/bdd.js:44:27)
at Object. (/home/web/app/node_modules/ts-node/src/index.spec.ts:13:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at /home/web/app/node_modules/mocha/lib/mocha.js:230:27
at Array.forEach (native)
at Mocha.loadFiles (/home/web/app/node_modules/mocha/lib/mocha.js:227:14)
at Mocha.run (/home/web/app/node_modules/mocha/lib/mocha.js:495:10)
at Object. (/home/web/app/node_modules/mocha/bin/_mocha:460:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:390:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:505:3
Process finished with exit code 1
I figured it out, my path was from the root of my project, which contained node_modules, and so the node_modules directory was being tested, causing errors from tests inside the ts-node folder. the fix was to exclude node_modules directory from the specified path for test modules.