I have the following code...
[
{
"number": 0,
"color": "blue",
"content": require('./first-card.pug')
}
...
]
When I try to run Webpack I see...
ERROR in ./src/app/jg/cards/cards.json
Module build failed: SyntaxError: Unexpected token r
at Object.parse (native)
Do I need to escape or something?
Related
I have tried searching the web and deleting the node module twice and restarting the pc nothing seems to work.
This is the exact error.
Starting project at C:\Users\Admire\OneDrive\Documents\Projects\project-dharan\app
JsonFileError: Error parsing JSON:
└─ Cause: SyntaxError: Unexpected token in JSON at position 0
1 |
| ^
JsonFileError: Error parsing JSON:
└─ Cause: SyntaxError: Unexpected token in JSON at position 0
1 |
| ^
at parseJsonString (C:\Users\Admire\AppData\Roaming\npm\node_modules\expo\node_modules#expo\json-file\build\JsonFile.js:160:19)
at Function.readAsync (C:\Users\Admire\AppData\Roaming\npm\node_modules\expo\node_modules#expo\json-file\build\JsonFile.js:139:12)
at async getPackageVersionAsync (C:\Users\Admire\AppData\Roaming\npm\node_modules\expo\node_modules#expo\cli\build\src\start\doctor\dependencies\validateDependenciesVersions.js:140:25)
at async Promise.all (index 7)
at async resolvePackageVersionsAsync (C:\Users\Admire\AppData\Roaming\npm\node_modules\expo\node_modules#expo\cli\build\src\start\doctor\dependencies\validateDependenciesVersions.js:118:44)
at async getVersionedDependenciesAsync (C:\Users\Admire\AppData\Roaming\npm\node_modules\expo\node_modules#expo\cli\build\src\start\doctor\dependencies\validateDependenciesVersions.js:88:29)
at async validateDependenciesVersionsAsync (C:\Users\Admire\AppData\Roaming\npm\node_modules\expo\node_modules#expo\cli\build\src\start\doctor\dependencies\validateDependenciesVersions.js:49:27)
at async startAsync (C:\Users\Admire\AppData\Roaming\npm\node_modules\expo\node_modules#expo\cli\build\src\start\startAsync.js:109:9)
I have found the solution in the subredit for the identical problem but there is no way I can follow the solution mentioned in the link
this is my package json file
{
"name": "project-dharan",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"#react-navigation/native": "^6.1.2",
"#react-navigation/native-stack": "^6.9.8",
"expo": "^47.0.13",
"expo-status-bar": "~1.4.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"react-native": "0.70.5",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-native-svg": "13.4.0",
"react-native-svg-transformer": "^1.0.0",
"react-native-web": "~0.18.7"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
I am having some trouble working with the AWS CLI when including an input to my event target. Without the input this command and json file work fine. When creating inputs via the console I don't have any problems.
BASH command:
aws events put-targets --cli-input-json file://target.json
JSON File:
{
"Rule": "site.la-01-rule",
"Targets": [
{
"Id": "site.la-01",
"Arn": "arn:aws:lambda:us-west-1:<account-number>:function:annual-rotation-schedules",
"Input": "This is an input"
}
]
}
ERROR Message:
An error occurred (ValidationException) when calling the PutTargets operation: JSON syntax error in input for target site.la-01: [Source: (String)"This is an input"; line: 1, column: 5
OTHER INFO:
The encoding of the JSON file is us-ascii
I am following the documentation here: https://awscli.amazonaws.com/v2/documentation/api/2.1.29/reference/events/put-targets.html
Thank you for your help!
The Input field should be in json format.
Input -> (string)
Valid JSON text passed to the target. In this case, nothing from the event itself is passed to the target.
So the target.json should be something like:
{
"Rule": "site.la-01-rule",
"Targets": [{
"Id": "site.la-01",
"Arn": "arn:aws:lambda:us-west-1:<account-number>:function:annual-rotation-schedules",
"Input": "{\"key\":\"value\"}"
}
]
}
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'm getting an error while working with grunt,
Error cannot parse config file unexpected token in default.json
I tried correcting the code but I'm receiving the same error
This is my default.json file:
{
"Amazon" : {
"lambda-arn" : "arn:aws:lambda:us-east-1:286506727102:function:myPandora",
},
"Pb": {
"url": "https://aiaas.xxx",
"app_id": "1xxxx1",
"user_key": "070xxxxxx",
"botname": "alexa"
},
}
Please help me with this error, Thank you.
Delete the commas at the end of lines 3 and 10 in your JSON to make it valid. E.g.
{
"Amazon": {
"lambda-arn": "arn:aws:lambda:us-east-1:286506727102:function:myPandora"
},
"Pb": {
"url": "https://aiaas.xxx",
"app_id": "1xxxx1",
"user_key": "070xxxxxx",
"botname": "alexa"
}
}
I am trying to assign an array stored in json into an array in a controller when I press a button. I have run my json against several online validators and all of them claim my json is valid. However, when I go to parse it I get an unexpected token error.
I have double checked everything and I think everything closely mirrors the tutorial I am going through at https://docs.angularjs.org/tutorial/step_05 but it just doesn't want to work.
Relevant Controller Lines:
angular.module('myApp.controllers', [])
.controller('PlayerAdditionCtrl', function($scope, $http) {
$scope.players = [];
$scope.loadDefaults = function()
{
$http.get('defaults.json').success(function(array)
{
//assignment here
});
}
});
Complete json:
[
{
"name": "Mike",
"color": "teal"
},
{
"name": "Madre",
"color": "seagreen"
},
{
"name": "Anthony",
"color": "royalblue"
},
{
"name": "GI-Joe",
"color": "olivedrab"
}
]
Complete error text from chrome:
SyntaxError: Unexpected token {
at Object.parse (native)
at fromJson (http://localhost:8000/app/bower_components/angular/angular.js:1078:14)
at $HttpProvider.defaults.defaults.transformResponse (http://localhost:8000/app/bower_components/angular/angular.js:7317:18)
at http://localhost:8000/app/bower_components/angular/angular.js:7292:12
at Array.forEach (native)
at forEach (http://localhost:8000/app/bower_components/angular/angular.js:323:11)
at transformData (http://localhost:8000/app/bower_components/angular/angular.js:7291:3)
at transformResponse (http://localhost:8000/app/bower_components/angular/angular.js:7963:17)
at wrappedCallback (http://localhost:8000/app/bower_components/angular/angular.js:11319:81)
at http://localhost:8000/app/bower_components/angular/angular.js:11405:26 angular.js:9778
(anonymous function) angular.js:9778
(anonymous function) angular.js:7216
wrappedCallback angular.js:11322
(anonymous function) angular.js:11405
Scope.$eval angular.js:12412
Scope.$digest angular.js:12224
Scope.$apply angular.js:12516
done angular.js:8204
completeRequest angular.js:8412
xhr.onreadystatechange angular.js:8351
Check your json/and/or/pathtojson again your code works for me
http://plnkr.co/edit/AGdJ9SasmHn74RQe8xX2?p=preview