I have newman (shell runner for postman tests) installed on Windows 10.
When i try to run a script via node which calls the newman module i get the following error:
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 Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous>
It is trying to run some bash code here which fails for obvious reasons.
I noticed that in the C:...\AppData\Roaming\npm folder there are two files for newman - a windows batch script and a linux bash script both called newman which contains the code mentioned above.
Why is it trying to run the linux version of newman on my windows machine? When i remove the bash script it says it cannot find a newman module. It doesn't even try to run the windows batch file instead, it is completely ignored.
Edit: Just reinstalled npm newman module just to be sure, didn't help.
Related
I'm looking at a file in WebStorm that contains Jest tests. I can run Jest via a run configuration and it works fine.
However, I can't right-click on a test in the editor and run it, nor do I get any gutter icons that would let me do so. I can right-click on a describe or it block and I have the option to run or debug, but it's trying to run/debug the file, not run the test:
(function (exports, require, module, __filename, __dirname) { import React from "react";
^^^^^
SyntaxError: Unexpected identifier
at new Script (vm.js:80:7)
at createScript (vm.js:274:10)
at Object.runInThisContext (vm.js:326:10)
at Module._compile (internal/modules/cjs/loader.js:664:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
at startup (internal/bootstrap/node.js:283:19)
Process finished with exit code 1
This is a new installation on a new M1 MacBook Pro, but it's got my settings synced with my other machines, so I don't see any reason why this wouldn't work like all my other WebStorm installations. (And it's not just this file, it's any test file anywhere.)
The problem solved itself when I removed babel-jest from our dependencies and added jest, which hadn't previously been there even though the tests would run, including using the "Run tests" run config.
As #lena suggested, the problem appeared to be not having Jest in the package file.
I am trying to follow the given steps in https://github.com/Microsoft/PowerBI-visuals-docs/blob/master/tools/README.md# installation to create my custom visuals in PowerBI.
I installed nodeJS 4.0+ and trying to install powerbi-visual-tools with the command npm install -g powerbi-visuals-tools. To confirm it was installed correctly we can run the command pbviz without any parameters which should display the help screen. But i am getting an error in my cmd
C:\>pbiviz
C:\Users\code1234\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\bin\pbiviz.js:30
let exec = require('child_process').execSync;
^^^
SyntaxError: Unexpected strict mode reserved word
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
C:\>
Can any one help me in moving to the next steps in the PowerBI Visual Tools (pbiviz) - Installation
I am trying to get continuous integration working for my Azure website which uses grunt, npm and bower to build.
I have followed the instructions here: http://www.cptloadtest.com/2013/12/03/Git-And-Grunt-Deploy-To-Windows-Azure.aspx and have modified my deploy.sh deployment section to match.
When I deploy I get the following error message:
Command: bash deploy.sh
Handling node.js grunt deployment.
An error has occurred during web site deployment.
C:\Program Files (x86)\SiteExtensions\Kudu\45.40522.1562\bin\scripts\selectNodeVersion.js:115
select node version failed
throw new Error('Usage: node.exe selectNodeVersion.js <path_to_repo> <path
^
Error: Usage: node.exe selectNodeVersion.js <path_to_repo> <path_to_wwwroot> [path_to_temp]
at Object.<anonymous> (C:\Program Files (x86)\SiteExtensions\Kudu\45.40522.1562\bin\scripts\selectNodeVersion.js:115:11)
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:906:3
Does anybody know what I could try next?
I also had some problems doing build and deployment in visual studio online. I added a command line "npm.cmd cache clean" at the top of my build definition. That made it work. Maybe that helps you too.
I am trying to deploy a node app that runs fine on my local Mac Lion, however. On the virtual Ubuntu box, it is giving an error:
module.js:340
throw err;
^
Error: Cannot find module '../lib/review'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/websites/Node_apps/min-driver-node/routes/reviews.js:2:14)
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 Module.require (module.js:364:17)
There is my own custom modules in ./lib folder that are 'require' from the routes as following:
var Review = require('../lib/review');
What have I tried?
Ensured the same Node.js version running via
nvm(https://github.com/creationix/nvm)
Removed node_modules just to
re-install them by running "npm install"
Why is the 'require' unable import the custom modules from 'lib' folder on Server while works on Mac? Thank You
Try using the complete path to the file instead of using the relative path (../).
It looks like the 'require' module is case sensitive on Ubuntu but not on Mac....all my modules in lib folder starts with upper case(i.e. lib/Review.js), but when required in other parts of the code, it is lower case - require('../lib/review'). This is causing issue on Ubuntu but not on Mac lion. By updating the code to 'require('../lib/Review'), solves the problem
Is this a bug and i should be reporting this?
Try set file permissions chmod -R 744 '../lib/review'
Quite simply, I'm attempting to automate running a nodejs script using cron, however the script itself doesn't seem to be able to run the file. My script is simple:
#!/usr/bin/env node
node /var/node/assets/js/update.js
However, in running this, it returns that the beginning of the pathing is incorrect:
/home/dev/update.sh:2
node /var/node/assets/js/update.js
^^^
SyntaxError: Unexpected token var
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:901:3
Is there something actually wrong with the bash, or does node have a specific way of doing this? I used /bin/env so that I could have the proper form of "node" regardless of version.
It looks like you are trying to run node from within node. The error message came from node and it looks like node was trying to run the command /var/node/assets/js/update.js.
I would make the shebang line specify bash rather than node.
The top line
#!/usr/bin/env node
means that what follows should be JavaScript code, not bash.
You are already running node on the first line in an unmodified environment.
then on the second line you supply the command node /var/node/assets/js/update.js to that node process.
How about this:
#!/usr/bin/bash
node /var/node/assets/js/update.js
How about this?
#!/bin/bash
node /var/node/assets/js/update.js