I am trying to add proxy to change the origin to the server
like
from http://localhost:4200/api/deaprtment/get/2
to http://localhost:7201/api/department/get/2
note that localhost:4200 is what my angular app run in
and localhost:7201 is what my asp.net server run in
my proxy-config.json is
{
"/api": {
"target": "http://localhost:7201",
"secure": false
}
}
it's in src/proxy-config.json
my angular.json is
.
.
.
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "test2:build:production"
},
"development": {
"browserTarget": "test2:build:development",
"proxyConfig": "src/proxy-config.json"
}
},
"defaultConfiguration": "development"
},
.
.
.
and when run ng serve
it's always give me that error:
Generating browser application bundles (phase: setup)...An unhandled exception occurred: Proxy configuration file
C:\Users\nasse\RiderProjects\Solution2\test2\src\proxy-c onfig.json
contains parse errors: [1, 1] InvalidSymbol See
"C:\Users\nasse\AppData\Local\Temp\ng-T9wrQt\angular-errors.log" for
further details.
Just had the same error, when updating to angular 14. Change the encoding of the proxy.config.json file from UTF-8-BOM to UTF-8 worked for me.
Related
I'm trying to use mysql module in a node js project (node 18.12, mysql 2.18.1)
in my project I must use
"type": "module"
in my package.json because the app is constructed with modules. for example i use this imports in the head of my app.js
import { createServer } from 'node:http';
import fs from 'node:fs/promises';
import { createTodo, findTodos } from './functions/storage.js';
import { index,create } from './functions/api/api.js';
then I add the line, like in the doc
var mysql = require('mysql');
but when I launch the app i have this error
mysql node module "require is not defined in ES module scope, you can
use import instead"
I have tried to change type to commonjs but get the same error in the other way, tried to change the extensions of the js file for cjs or mjs . every time same type of error.
How can I use mysql with "native" module node app ?
I'm a beginner in node so, sorry if it is a dumb question, but I can't find any answer by the web.
Here is my package.json
{
"name": "project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"type": "module",
"keywords": [],
"author": "",
"license": "ISC",
"volta": {
"node": "18.12.1"
},
"dependencies": {
"mysql": "^2.18.1"
}
}
Try to remove "type":"module" from package.json.
From How to fix reference error require is not defined in javascript
I finally found the answer here
const require = createRequire(import.meta.url);
var mysql = require('mysql');
I hope this will be useful for other people ;)
After running polymer build in my project's root director using the Polymer CLI 1.1.0, I get this error:
info: Clearing build/ directory...
error: Uncaught exception: Error: File not found with singular glob: /home/willie/Projects/World History Final Project/src/passport-app/passport-app.html
error: Error: File not found with singular glob: /home/willie/Projects/World History Final Project/src/passport-app/passport-app.html
at Glob.<anonymous> (/usr/lib/node_modules/polymer-cli/node_modules/glob-stream/index.js:41:11)
at Glob.g (events.js:292:16)
at emitOne (events.js:96:13)
at Glob.emit (events.js:188:7)
at Glob._finish (/usr/lib/node_modules/polymer-cli/node_modules/glob-stream/node_modules/glob/glob.js:172:8)
at done (/usr/lib/node_modules/polymer-cli/node_modules/glob-stream/node_modules/glob/glob.js:159:12)
at Glob._processSimple2 (/usr/lib/node_modules/polymer-cli/node_modules/glob-stream/node_modules/glob/glob.js:652:12)
at /usr/lib/node_modules/polymer-cli/node_modules/glob-stream/node_modules/glob/glob.js:640:10
at Glob._stat2 (/usr/lib/node_modules/polymer-cli/node_modules/glob-stream/node_modules/glob/glob.js:736:12)
at lstatcb_ (/usr/lib/node_modules/polymer-cli/node_modules/glob-stream/node_modules/glob/glob.js:728:12)
I want to know why this keeps happening.
The Polymer CLI is designed to build apps using the REPL app shell architecture. In your polymer.json file, you must define any "fragments" that are lazy-loaded. After adding the fragments to the file, running polymer build in the directory containing the config file.
{
"entrypoint": "index.html",
"shell": "src/passport-app.html",
"fragments": [
//This is where you messed up.
"src/passport-home.html",
"src/passport-introduction.html",
"src/passport-404.html",
"src/passport-economy.html",
"src/passport-news.html",
"src/passport-immigration.html",
"src/passport-culture.html"
],
"sources": [
"src/**/*",
"images/**/*",
"bower.json"
],
"extraDependencies": [
"manifest.json",
"bower_components/webcomponentsjs/*.js"
],
"lint": {
"rules": [
"polymer-2"
]
},
"builds": [
{
"preset": "es6-bundled"
}
]
}
I've installed ELK on my ubuntu server using this manual,
Now i want to index some log files from a windows server so I installed a logstash forwarder (LumberJack), but I can't get it to run.
this is the logstash-forwarder.conf file :
{
"network": {
"servers": [ "http://XX.XX.XX.XX:5000" ],
"ssl key": "D:/lumberjack/pki/tls/certs/logstash-forwarder.crt",
"ssl ca": "D:/lumberjack/pki/tls/certs/logstash-forwarder.crt",
"timeout": 15,
},
"files": [
{
"paths": [
#single paths are fine
"D:/bea12/Oracle/Middleware/domains/Google/servers/RT1/logs/AppLogs/RT1_APP_9_0.log",
#globs are fine too, they will be periodically evaluated
#to see if any new files match the wildcard.
"/var/logauth.log"
],
]
}
}
and this is the Error I get when i'm trying to run the "lumberjack.exe" ,
That I created with go-build:
2015/04/30 18:17:39.052033 Failed unmarshalling json: invalid character '}' looking for beginning of object key string
2015/04/30 18:17:39.052033 Could not load config file d:\lumberjack\logstash-forwarder.conf: invalid character '}' looking for beginning of object key string
Can anyone please tell me what am I doing wrong?
By the way this is the command I'm using to run the forwarder:
lumberjack.exe -config="d:\lumberjack\logstash-forwarder.conf"
Ok.
So the problem was in the configuration file, There were 2 unnecesary commas and no need for the http:\ at the start:
{
"network": {
"servers": [ "XX.XX.XX.XX:5000" ],
"ssl key": "D:/lumberjack/pki/tls/certs/logstash-forwarder.key",
"ssl ca": "D:/lumberjack/pki/tls/certs/logstash-forwarder.crt",
"timeout": 15
},
"files": [
{
"paths": [
#single paths are fine
"D:/bea12/Oracle/Middleware/domains/google/servers/RT1/logs/AppLogs/RT1_APP_9_0.log",
#globs are fine too, they will be periodically evaluated
#to see if any new files match the wildcard.
"/var/logauth.log"
]
}
]
}
This is my suggested configuration file for LumberJack on windows.
I am trying to load a simple CSV file to OrientDB and it always throws this exception.
CSV File Content
id, name, role
1, Sarath, Architect
2, Anoop, Project Manager
3, Nazeem, Lead Developer
4, Rini, Senior Developer
5, Shine, iOS Developer
6, Vishnu, iOS Developer
json config file
{
"source": { "file": { "path": "./dev.csv" } },
"extractor": { "row": {} },
"transformers": [
{
"csv": {}
},
{ "vertex": { "class": "Person" } }
],
"loader": {
"orientdb": {
"dbURL": "remote:localhost/dev",
"dbType": "graph",
"dbUser": "root",
"dbPassword": "root",
"dbAutoCreate": true,
"classes": [
{"name": "Person", "extends": "V"}
], "indexes": [
{"class":"Person", "fields":["id:integer"], "type":"UNIQUE" }
]
}
}
}
All the time it shows this exception. I tried different CSV options but it did not work. Looks like the file reading itself throwing exception.
» oetl posts.json sarat#Saraths-MacBook-Air
OrientDB etl v.2.0.1 (build #BUILD#) www.orientechnologies.com
Exception in thread "main" com.orientechnologies.orient.core.exception.OConfigurationException: Error on loading config file: posts.json
at com.orientechnologies.orient.etl.OETLProcessor.main(OETLProcessor.java:151)
Platform Details
OS X 10.10.2
java version "1.8.0_25"
OrientDB - v.2.0.1
The stack trace gives you the cause of the problem (you only showed the first, not interesting lines in your example).
Check:
The server is running (you specified remote:localhost/dev, so the server must be running on the default port at the same machine).
The database exists and has "root" / "root" as credentials (note that mostly "admin" "admin" is used)
The file dev.csv is present in the current directory
Tried out your example and works without modification.
I had the same problem, and it was due to one of the directories in the path to the JSON config file having a space in it. The oetl script doesn't handle this well and thus can't find the script.
#rmuller: The OP showed the entire traceback. That's all you get in this case.
I have a program, which is using what they called wmake to build the code and it's very convenient. Suppose I have a folder and a C++ file: /path/to/file.C, all I have to do is go to /path/to folder and then type the wmake command and return and all is set.
When I am using sublimetext, I would like to open this file.C file and then ctrl+B to build it, but it doesn't work. Currently I customized a build system like:
{
"cmd": "wmake"
}
the error shows as
[Errno 2] No such file or directory
[cmd: wmake]
[dir: /path/to/file.C]
[path: /home/meee/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin]
[Finished]
Anyone knows how to customize a build system in sublimetext2? I read the online mannual but still have no clue. Thanks
My aim
All I want to do is to get the same effect as I type in shell window a simple
wmake /path/to
Edit-1
I tried this, it's not working either, the same error. I dont understand why "no such file"?
{
"cmd": "wmake",
"selector" : "source.C",
"shell": false,
"working_dir" : "$file_path",
"variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "wmake '${file_path}'"]
}
]
}
Edit-2
I tried using full path of wmake, and the error complains environment variable $WM_OPTIONS not set. So in shell, every time the ~/.bashrc is auto loaded, and to initialize all the environment variables, but this is not so in Sublime!!!!!!!!!!!!! What should I do???
{
"cmd": "/fullpath/to/wmake",
"selector" : "source.C",
"shell": false,
"working_dir" : "$file_path",
"variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "/fullpath/to/wmake '${file_path}'"]
}
]
}
Your build command isn't complete. See my customized C build:
{
"cmd" : ["/usr/local/gfortran/bin/gcc", "$file_name", "-o", "${file_base_name}", "-lgsl","-lgslcblas", "-lm" , "-Wall"],
"selector" : "source.c",
"shell":false,
"working_dir" : "$file_path",
"variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "/usr/local/gfortran/bin/gcc '${file}' -lgsl -lgslcblas -lm -Wall -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
}
]
}