I am trying to use search functionality using downloaded ArcGIS JavaScript API v4.27. Here is my code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-
scale=1,user-scalable=no" />
<title>Test local installation of ArcGIS Maps SDK for
JavaScript</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height:100%;
width: 100%;
}
</style>
<!-- Load the ArcGIS CSS directly from the CDN -->
<link rel="stylesheet" href="./esri/themes/light/main.css" />
<!-- Load the ArcGIS SDK script directly from the CDN -->
<script src="./init.js"></script>
<script>
require([
"esri/config",
"esri/Basemap",
"esri/layers/TileLayer",
"esri/Map",
"esri/views/SceneView",
"esri/widgets/Search" // Add the Search module
], function (esriConfig,Basemap, TileLayer, Map, SceneView,
Search) {
esriConfig.assetsPath ="/assets";
const layer = new TileLayer({
url: "https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer"
});
const customBasemap = new Basemap({
baseLayers: [layer],
title: "My Basemap"
});
const myMap = new Map({
basemap: customBasemap
});
const view = new SceneView({
container: "viewDiv",
map: myMap
});
// Add a Search widget to the view's UI
const search = new Search({
view: view
});
view.ui.add(search, "top-right");
});
</script>
</head>
<body>
<div id="viewDiv"></div>
<div id="logDiv"></div>
</body>
</html>
I am getting this error:
Using ArcGIS Maps SDK for JavaScript 4.27 [Date: 20230626, Revision: b81703b4] [esri.widgets.Attribution] widget-intl:locale-error esri.widgets.Attribution q {name: 'intl:message-bundle-error', details: {…}, message: 'Errors occurred while loading "esri/widgets/Attribution/t9n/Attribution"'} [esri.widgets.Zoom] widget-intl:locale-error esri.widgets.Zoom q {name: 'intl:message-bundle-error', details: {…}, message: 'Errors occurred while loading "esri/widgets/Zoom/t9n/Zoom"'} [esri.widgets.NavigationToggle] widget-intl:locale-error esri.widgets.NavigationToggle q {name: 'intl:message-bundle-error', details: {…}, message: 'Errors occurred while loading "esri/widgets/NavigationToggle/t9n/NavigationToggle"'} [esri.widgets.Compass] widget-intl:locale-error esri.widgets.Compass q {name: 'intl:message-bundle-error', details: {…}, message: 'Errors occurred while loading "esri/widgets/Compass/t9n/Compass"'} [esri.widgets.Search] widget-intl:locale-error esri.widgets.Search q {name: 'intl:message-bundle-error', details: {…}, message: 'Errors
...
(d:\Rakesh\arcgis_js_v427_api\arcgis_js_v427_api\arcgis_js_api\javascript\4.27\init.js:1717:169) at a.when (d:\Rakesh\arcgis_js_v427_api\arcgis_js_v427_api\arcgis_js_api\javascript\4.27\init.js:2638:266) [esri.views.3d.environment.Stars] q {name: 'request:server', details: {…}, message: 'Failed to fetch'}
undefined.(d:\Rakesh\arcgis_js_v427_api\arcgis_js_v427_api\arcgis_js_api\javascript\4.27\init.js:1717:82) at t
What is the reason for the error and the fix?