Coder Social home page Coder Social logo

Comments (2)

gavinr-maps avatar gavinr-maps commented on May 23, 2024

I do get an error when run:

cd demos/geocoder-browser
npm i
npm start

... on Windows 10 in Powershell.

The error I get:

> @esri/[email protected] start
> node ../../scripts/run-demo-server.js

node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
    at new NodeError (node:internal/errors:405:5)
    at validateString (node:internal/validators:162:11)
    at join (node:path:429:7)
    at getPackages (file:///C:/_work/arcgis-rest-js/scripts/get-package-json.js:19:37)
    at async file:///C:/_work/arcgis-rest-js/scripts/run-demo-server.js:7:20 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v18.17.1
npm ERR! Lifecycle script `start` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: @esri/[email protected]
npm ERR!   at location: C:\_work\arcgis-rest-js\demos\geocoder-browser

I agree with @hhkaos that we need to get the script at https://github.com/Esri/arcgis-rest-js/blob/main/scripts/get-package-json.js#L19 to be more Windows friendly.

from arcgis-rest-js.

COV-GIS avatar COV-GIS commented on May 23, 2024

__dirname is not being constructed properly. The root should be the project directory not the full path of the project directory on disk.

import * as url from 'url';
import { readFile } from "fs/promises";
import { globby } from "globby";
import pkgDir from "pkg-dir";
import { join } from "path";

const __dirname = url.fileURLToPath(new URL('.', import.meta.url));

/**
 * Returns an object like:
 *
 * {
 *   packageName: package.json contents
 * }
 *
 * For all packages in the packages/* folder.
 */
export default async function getPackages() {
  const rootDir = await pkgDir(__dirname);
  const packageFiles = await globby(join(rootDir, "packages/*/package.json"));
  return Promise.all(
    packageFiles.map((pkgPath) => {
      return readFile(pkgPath).then((pkg) => {
        return JSON.parse(pkg);
      });
    })
  );
}

from arcgis-rest-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.