Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gl-stype-spec is not working #400

Closed
JinIgarashi opened this issue Sep 26, 2021 · 5 comments
Closed

gl-stype-spec is not working #400

JinIgarashi opened this issue Sep 26, 2021 · 5 comments

Comments

@JinIgarashi
Copy link
Contributor

maplibre-gl-js version: @maplibre/maplibre-gl-style-spec v14.0.1

https://www.npmjs.com/package/@maplibre/maplibre-gl-style-spec

browser:

Steps to Trigger Behavior

  1. Install maplibre-gl-style-spec globally
npm install @maplibre/maplibre-gl-style-spec --global
  1. Execute any command of gl-style-spec CLI tools.
gl-style-composite

Link to Demonstration

https://jsbin.com/

Expected Behavior

all CLI tools should work after installing the package.

Actual Behavior

When I execute CLI tool of gl-style-spec, it will occur the following error due to no main entry in package.json

 gl-style-composite
internal/modules/cjs/loader.js:316
      throw err;
      ^

Error: Cannot find module '/Users/j_igarashi/.nvm/versions/node/v14.17.0/lib/node_modules/@maplibre/maplibre-gl-style-spec/dist/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:308:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:521:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:872:27)
    at Function.Module._load (internal/modules/cjs/loader.js:730:27)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/j_igarashi/.nvm/versions/node/v14.17.0/lib/node_modules/@maplibre/maplibre-gl-style-spec/bin/gl-style-composite:6:14)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/Users/j_igarashi/.nvm/versions/node/v14.17.0/lib/node_modules/@maplibre/maplibre-gl-style-spec/package.json',
  requestPath: '../'
}
@wipfli
Copy link
Contributor

wipfli commented Sep 26, 2021

Thanks for the feedback. Does v14.0.0 work?

@JinIgarashi
Copy link
Contributor Author

@wipfli v14.0.0 also does not work. But it is different error.

npm install @maplibre/[email protected] --global
gl-style-composite

internal/fs/utils.js:626
    throw new ERR_INVALID_ARG_TYPE(propName, ['string', 'Buffer', 'URL'], path);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
    at Object.openSync (fs.js:490:10)
    at Object.readFileSync (fs.js:394:35)
    at Object.<anonymous> (/Users/j_igarashi/.nvm/versions/node/v14.17.0/lib/node_modules/@maplibre/maplibre-gl-style-spec/bin/gl-style-composite:9:44)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'ERR_INVALID_ARG_TYPE'
}

However, gl-style-validate seems working in v14.0.0.

@wipfli
Copy link
Contributor

wipfli commented Sep 26, 2021

Thanks for opening this issue. The command line tools have a bit a strange way to tell you if your input is wrong. In particular, if you don't provide a path to a style file then you get this ugly file system error TypeError [ERR_INVALID_ARG_TYPE]: The "path" ...

Locally for me all commands work if I provide a style file in version 14.0.0:

nvm use 14
npm install @maplibre/[email protected] --global
gl-style-composite style.json
gl-style-format style.json
gl-style-validate style.json

However, with 14.0.1 (after typescript migration), I also get the errors that you report:

nvm use 14
npm install @maplibre/[email protected] --global
gl-style-composite style.json

internal/modules/cjs/loader.js:328
      throw err;
      ^

Error: Cannot find module '/home/wipfli/.nvm/versions/node/v14.17.6/lib/node_modules/@maplibre/maplibre-gl-style-spec/dist/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:320:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:533:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:875:27)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/home/wipfli/.nvm/versions/node/v14.17.6/lib/node_modules/@maplibre/maplibre-gl-style-spec/bin/gl-style-composite:6:14)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/home/wipfli/.nvm/versions/node/v14.17.6/lib/node_modules/@maplibre/maplibre-gl-style-spec/package.json',
  requestPath: '../'

So for now I suggest you use version 14.0.0 and I will keep you posted once we fix this.

@wipfli
Copy link
Contributor

wipfli commented Sep 26, 2021

Should be fixed now, I published v14.0.2 on NPM. Give it a try and let me know if it works for you too. Thanks for the feedback again!

@JinIgarashi
Copy link
Contributor Author

@wipfli Thank you for fixing this issue quickly! I close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants