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

2.1.2 broken #990

Closed
hheexx opened this issue Feb 12, 2022 · 14 comments · Fixed by #991, #992 or #994
Closed

2.1.2 broken #990

hheexx opened this issue Feb 12, 2022 · 14 comments · Fixed by #991, #992 or #994

Comments

@hheexx
Copy link

hheexx commented Feb 12, 2022

During npm update:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ts-node' imported from /home/hex/ZweloProject/ClientApp/node_modules/maplibre-gl/
at new NodeError (node:internal/errors:371:5)
npm ERR! at packageResolve (node:internal/modules/esm/resolve:884:9)
npm ERR! at moduleResolve (node:internal/modules/esm/resolve:929:18)
npm ERR! at defaultResolve (node:internal/modules/esm/resolve:1044:11)
npm ERR! at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
npm ERR! at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
npm ERR! at ESMLoader.import (node:internal/modules/esm/loader:276:22)
npm ERR! at initializeLoader (node:internal/process/esm_loader:74:49)
npm ERR! at loadESM (node:internal/process/esm_loader:87:11)
npm ERR! at runMainESM (node:internal/modules/run_main:47:21) {
npm ERR! code: 'ERR_MODULE_NOT_FOUND'

@HarelM
Copy link
Collaborator

HarelM commented Feb 12, 2022

Can you please elaborate the steps to reproduce?
It might be related to the post install scripts we added, but I don't want to guess...

@GraxMonzo
Copy link

@HarelM

  1. Changed maplibre-gl version to ^2.1.2.
  2. Executed yarn.
[4/4] Building fresh packages...
[1/4] ⠁ maplibre-gl
[-/4] ⠁ waiting...
[3/4] ⠁ core-js
error D:\projects\gis-admin\node_modules\maplibre-gl: Command failed.
Exit code: 1
Command: npm run codegen && npm run generate-query-test-fixtures
Arguments: 
Directory: D:\projects\gis-admin\node_modules\maplibre-gl
Output:
> [email protected] codegen
> npm run generate-style-code && npm run generate-struct-arrays && npm run generate-style-spec && npm run generate-shaders


> [email protected] generate-style-code
> node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-code.ts

(node:2952) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2952) ExperimentalWarning: The Node.js specifier resolution in ESM is experimental.
(node:2952) ExperimentalWarning: The Node.js specifier resolution in ESM is experimental.
TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module "file:///D:/projects/gis-admin/node_modules/maplibre-gl/build/generate-style-code.ts"
    at new NodeError (node:internal/errors:371:5)
    at ESMLoader.load (node:internal/modules/esm/loader:324:13)
    at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:230:47)
    at async link (node:internal/modules/esm/module_job:67:21) {

@HarelM
Copy link
Collaborator

HarelM commented Feb 12, 2022

Yes, looks like the post install. Thanks for reporting! If you are familiar with post install that will happen only when using npm install for this repo it will help a lot!

@HarelM
Copy link
Collaborator

HarelM commented Feb 12, 2022

This is probably the solution:
https://stackoverflow.com/questions/23076968/npm-postinstall-only-on-development
Use prepare instead of post install?

@jimmyrocks
Copy link

I am running into a similar issue this morning, this works with version 2.1.1, but 2.1.2 produces this error.
I tried it on two machines:

  • (node version: v16.13.2, npm: 8.4.0, OS: Debian GNU/Linux 10 (buster) 5.10.76-linuxkit, CPU: Apple M1 (aarch64))
  • (node version: v16.13.2, npm: 8.1.2, OS: Ubuntu 20.04.3 LTS (Focal Fossa)), CPU: Intel i7 (x86_64))

It might be a different issue, since it's talking about ts-node.

I created a very simple package.json: (I also tried it as a dependency on both machines)

{
  "name": "test",
  "devDependencies": {
    "maplibre-gl": "2.1.2"
  }
}

This is the error I get when I run npm install

$ npm install                                                                                                                                             
npm ERR! code 1
npm ERR! path /projects/test/node_modules/maplibre-gl
npm ERR! command failed
npm ERR! command sh -c npm run codegen && npm run generate-query-test-fixtures
npm ERR! > [email protected] codegen
npm ERR! > npm run generate-style-code && npm run generate-struct-arrays && npm run generate-style-spec && npm run generate-shaders
npm ERR!
npm ERR!
npm ERR! > [email protected] generate-style-code
npm ERR! > node --loader ts-node/esm --experimental-specifier-resolution=node build/generate-style-code.ts
npm ERR! (node:1831) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
npm ERR! (Use `node --trace-warnings ...` to show where the warning was created)
npm ERR! node:internal/errors:464
npm ERR!     ErrorCaptureStackTrace(err);
npm ERR!     ^
npm ERR!
npm ERR! Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ts-node' imported from /projects/test/node_modules/maplibre-gl/
npm ERR!     at new NodeError (node:internal/errors:371:5)
npm ERR!     at packageResolve (node:internal/modules/esm/resolve:884:9)
npm ERR!     at moduleResolve (node:internal/modules/esm/resolve:929:18)
npm ERR!     at defaultResolve (node:internal/modules/esm/resolve:1044:11)
npm ERR!     at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
npm ERR!     at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
npm ERR!     at ESMLoader.import (node:internal/modules/esm/loader:276:22)
npm ERR!     at initializeLoader (node:internal/process/esm_loader:74:49)
npm ERR!     at loadESM (node:internal/process/esm_loader:87:11)
npm ERR!     at runMainESM (node:internal/modules/run_main:47:21) {
npm ERR!   code: 'ERR_MODULE_NOT_FOUND'
npm ERR! }

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jimmyrocks/.npm/_logs/2022-02-12T15_48_12_520Z-debug-0.log

@HarelM
Copy link
Collaborator

HarelM commented Feb 12, 2022

According to SO prepare is not the right solution but instead using the env variable is probably the right solution... If anyone knows this better than I do feel free to submit a PR.

@wipfli
Copy link
Member

wipfli commented Feb 12, 2022

Workaround: npm install maplibre-gl --ignore-scripts

@hheexx
Copy link
Author

hheexx commented Feb 12, 2022

btw please consider introducing beta builds.
You break production little bit too often.

@wipfli
Copy link
Member

wipfli commented Feb 12, 2022

zloirock/core-js#582

@wipfli
Copy link
Member

wipfli commented Feb 12, 2022

btw please consider introducing beta builds.

Good idea, thanks for the feedback.

@wipfli wipfli reopened this Feb 12, 2022
@wipfli
Copy link
Member

wipfli commented Feb 12, 2022

Attempted a solution with #991, but this created a new problem:

➜  test npm install [email protected]
npm ERR! code 1
npm ERR! path /home/wipfli/maps/test/test/node_modules/maplibre-gl
npm ERR! command failed
npm ERR! command sh -c node ./postinstall.js
npm ERR! node:internal/modules/cjs/loader:936
npm ERR!   throw err;
npm ERR!   ^
npm ERR! 
npm ERR! Error: Cannot find module '/home/wipfli/maps/test/test/node_modules/maplibre-gl/postinstall.js'
npm ERR!     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR!     at node:internal/main/run_main_module:17:47 {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: []
npm ERR! }

@wipfli
Copy link
Member

wipfli commented Feb 12, 2022

The problem is: we do not distribute postinstall.js

@hheexx
Copy link
Author

hheexx commented Feb 12, 2022

Yup.
npm ERR! Error: Cannot find module '/home/hex/ZweloProject/ClientApp/node_modules/maplibre-gl/postinstall.js'
npm ERR! at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
npm ERR! at Function.Module._load (node:internal/modules/cjs/loader:778:27)
npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR! at node:internal/main/run_main_module:17:47 {
npm ERR! code: 'MODULE_NOT_FOUND',
npm ERR! requireStack: []
npm ERR! }

@wipfli
Copy link
Member

wipfli commented Feb 12, 2022

Still broken. We made the implicit assumption that process.env.NODE_ENV === 'production' holds true in the distributed library. This is not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment