So I'm getting this in my command terminal when I try to import the following file:
C:\Program Files\MongoDB\Server\3.2\bin>mongoimport --db test --collection horse_data --file horse1.json
2016-02-23T20:31:18.731-0500 connected to: localhost
2016-02-23T20:31:18.736-0500 Failed: error processing document #1: invalid character 'h' in literal Timestamp (expecting 'i')
2016-02-23T20:31:18.743-0500 imported 0 documents
With the following horse1.json file (Which I'm not entirely certain is correctly written, I've got very little experience with JavaScript:
{
_horse_name:"Seabiscuit",
_horse_gender:"Male",
_breed:"Thoroughbred",
_weight:1199,
_date_of_birth:"May 23, 1933",
_sire:"Hard Tack",
_mare:"Swing On",
_auction_price:104260
}
I'm honestly stumped here. Any pointers?
Related
Beginner here working with Javascript inside a script.js file in Visual Studio.
I wrote the following code to declare an array of objects and then console log the whole thing:
let frenchDictionary = [
{
"french": "qui",
"english":"who"
},
{
"french": "toujours",
"english":"always"
}
]
console.log(frenchDictionary)
But VS terminal throws the following error: frenchDictionary : The term 'frenchDictionary' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Why isn't it recognizing frenchDictionary as a variable?
Seems like you are trying to console log that from the PowerShell or something. Try typing this in the terminal:
node - NAME OF YOUR JAVASCRIPT FILE.js -
I am trying to get the output of a shell command into my node cli app. I have been trying so many things but nothing seems to get me the output.
The command I run has steps like:
$ particle token list
Checking with the cloud...
? Using account ****#****.com
Please enter your password: [hidden]
? Please enter a login code [optional]
__PASSWORD_ONLY__ (active)
token: sometoken here //this is what I and trying to get mainly
I am running it from my app like
const execute = require('child_process').spawnSync;
const child = execute('particle', ["token", "list"], {encoding: 'utf-8'});
if(child.error) {
console.log("ERROR: ",child.error);
}
console.log("stdout: ",child.stdout);
console.log("stderr: ",child.stderr);
console.log("exist code: ",child.status);
When I run it I get
$ node test.js
stdout: ? Using account ****#****.com
Please enter your password: [input is hidden]
stderr: Checking with the cloud...
exist code: 255
I have tried some other ways found by searching but didn't help much. What can I try so that the command would finish after inputting and returns all the outputs? Help would be much appreciated.
PS: It does not have to be spawnSync or any synchronous method, just using it for test purpose.
I'm trying to deploy my web app to App Engine in GCP. I have my API key and Client key stored in my app.yaml file. but when I try to deploy my app I'm getting this error:
ERROR: (gcloud.app.deploy) An error occurred while parsing file:
[C:\app.yaml]
Value 'API-KEY' for key in EnvironmentVariables does not match expression '^(?:
[a-zA-Z_][a-zA-Z0-9_]*)$'
in "C:\app.yaml", line 4, column 12
and here is my app.yaml file:
runtime: nodejs
env: flex
env_variables:
API-KEY: 'ExampleAPIKey'
CLIENT_ID: 'example123-clientkey1234567890.apps.googleusercontent.com'
I tried to remove the '' but I got the same error message. I don't know what I'm missing here.
I am developing an API automated test case using cucumber and JavaScript and I am getting this error:
Error: Parse error in 'test/step_definitions/requester.js': (1:1): expected: #EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got '//const fetch = require('node-fetch');'
I have a .feature file within 'features' folder.
In addition, I have two .js files within 'step_definitions' folder. Files are 'my_steps' and 'requester.js'.
The Gruntfile.js contains this line to run it:
command: './node_modules/.bin/cucumber-js /features/*.feature -r /Users/alfredo.bazo/XCore-ContentLibrary-Tests/API-Test/test/step_definitions/*.js',
As per error thrown, it seems that requester.js file is considered as a feature file. Why? How can I fix it?
Thanks in advance.
Ungit looks the perfect tool to learn how git works, as it gives a graphical interface to understand what is going on. I want to share this video explanation (very useful to understand how git works even if you are not planning to use ungit).
It has synchronized my local repository perfectly. Unfortunately, when I have typed the bickbucket git url, it has produced the following error:
Ungit tried to run a git command that resulted in an unhandled error. An automatic bug report was sent.
Command (I didn't type it myself, ungit sent it automatically after typing the URL
git -c color.ui=false -c core.quotepath=false -c core.pager=cat -c credential.helper="C:/Documents and Settings/ch/Datos de programa/npm/node_modules/ungit/bin/credentials-helper 0" ls-remote --tags prototype-towunderlist2
Error. The error is probably because there are spaces in C:/Documents and Settings:
Error: Command failed: C:/Documents and Settings/ch/Datos de programa/npm/node_modules/ungit/bin/credentials-helper 0 get: C:/Documents: No such file or directory
fatal: could not read Password for 'https://chelder86#bitbucket.org': No such file or directory
It looks a Windows issue for me, so I have published it in stackoverflow instead the ungit bug report system.
UPDATE 1. I have found out how to get by, but I got another error:
fatal: Authentication failed for 'https://chelder86#bitbucket.org/chelder86/prototype-towunderlist2.git/'
To get by, I did the following. I opened a new cmd (command line). I went into the repository directory. I typed the same command but adding single quotes into the double quotes as follows:
Instead:
"C:/Documents and Settings/ch/Datos de programa/npm/node_modules/ungit/bin/credentials-helper 0"
I typed:
"C:/'Documents and Settings'/ch/'Datos de programa'/npm/node_modules/ungit/bin/credentials-helper 0"
Then, a form appeared in the browser to wrote my username and password. I wrote them, and the new error appeared in the command line (not in the user interface of the browser).
Screenshot:
UPDATE 2: the line where is generated the path "C:/Documents and Settings/ch/Datos de programa/npm/node_modules/ungit/bin/credentials-helper 0" is located in C:\Documents and Settings\ch\Datos de programa\npm\node_modules\ungit\source\git-api.js. It is:
function credentialsOption(socketId) {
var credentialsHelperPath = path.resolve(__dirname, '..', 'bin', 'credentials-helper').replace(/\\/g, '/');
return '-c credential.helper="' + credentialsHelperPath + ' ' + socketId + '" ';
}
I'm not a Javascript expert, so I need some time to find out how to build the correct path...
UPDATE 3: the temporal fix of the code of UPDATE 2 is the following:
[It is a fix, so I wrote it as an answer instead]
The temporal fix of the code of UPDATE 2 is the following:
function credentialsOption(socketId) {
var credentialsHelperPath = path.resolve(__dirname, '..', 'bin', 'credentials-helper').replace(/\\/g, '/');
var botchedFix1 = '-c credential.helper="' + credentialsHelperPath + ' ' + socketId + '" ';
var botchedFix2 = botchedFix1.replace("Documents and Settings","'Documents and Settings'");
botchedFix2 = botchedFix2.replace("Datos de programa","'Datos de programa'");
return botchedFix2;
}
Then, if I click on Fetch Nodes from prototype-towunderlist2 in the user interface of the internet browser (Firefox), I can enter my username and password. Unfortutately, I got a new error:
Command
git -c color.ui=false -c core.quotepath=false -c core.pager=cat -c credential.helper="C:/'Documents and Settings'/ch/'Datos de programa'/npm/node_modules/ungit/bin/credentials-helper 0" ls-remote --tags prototype-towunderlist2
Error
Error: Command failed: fatal: Authentication failed for 'https://chelder86#bitbucket.org/chelder86/prototype-towunderlist2.git/'
However, if you copy and paste the same command in a new cmd (command line), it seems working perfectly. Push is also working.
Feel free to improve my ugly solution!