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

Parcel 2: parcel build fails with error related to lmdb-store #7237

Closed
Biosphakus opened this issue Nov 2, 2021 · 11 comments
Closed

Parcel 2: parcel build fails with error related to lmdb-store #7237

Biosphakus opened this issue Nov 2, 2021 · 11 comments

Comments

@Biosphakus
Copy link

Biosphakus commented Nov 2, 2021

I was trying to migrate from the Parcel bundler to Parcel 2 (using it with npm), at the same time also updating npm and node.js to more current versions. Parcel seems to have installed correctly but Parcel commands abort with error. (For the time being, I have downgraded back to parcel-bundler but this shouldn't be the solution).

🐛 bug report

When trying to build, I get the following error (also with watch and serve commands):

npm run build

> project_test@1.0.0 build
> echo try to build && parcel build --public-url about.html

try to build
Error: error: 127\\?\C:\xampp\htdocs\Project_Test\node_modules\lmdb-store\build\Release\lmdb-store.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (C:\xampp\htdocs\Project_Test\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
    at load (C:\xampp\htdocs\Project_Test\node_modules\node-gyp-build\index.js:21:10)
    at Object.<anonymous> (C:\xampp\htdocs\Project_Test\node_modules\lmdb-store\index.js:6:49)
    at Module._compile (C:\xampp\htdocs\Project_Test\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)

Unlike in the bug reports here or here, I do not get a specific error, just the path of where it fails.

Unfortunately, I have no idea where to go from here and how to solve it. Removing the node_modules directory and re-installing everything doesn't seem to fix the error; also trying to use a fresh project like in this example doesn't help.

🎛 Configuration (.babelrc, package.json, cli command)

Steps I've been taking:

Initialising a fresh project and installing Parcel

npm install --save-dev parcel
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 673 packages, and audited 674 packages in 51s

142 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

My package.json looks like this:

{
  "name": "project_test",
  "version": "1.0.0",
  "description": "Test for parcel",
  "main": "index.html",
  "scripts": {
    "build": "echo try to build && parcel build --public-url index.html",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "parcel": "^2.0.0"
  }
}

🤔 Expected Behavior

parcel build should work.

🌍 Environment

Software Version(s)
Parcel 2.0.0
Node 14.16.1
npm 8.1.2
Operating System Windows 7 (64 bit)*

*) Node 14.16.1 was installed on Windows 7 using the workaround described here.

@Biosphakus Biosphakus changed the title Cannot build after migrating to Parcel 2 Parcel 2: parcel build fails with error related to lmdb-store Nov 4, 2021
@Biosphakus Biosphakus changed the title Parcel 2: parcel build fails with error related to lmdb-store Parcel 2: parcel build fails with error related to lmdb-store Nov 4, 2021
@kriszyp
Copy link
Contributor

kriszyp commented Nov 4, 2021

@Biosphakus I create a test release with some of the windows API calls stripped out of lmdb-store. Would you be willing to try it out?

npm install lmdb-store@1.6.12-min-win
node
require('lmdb-store')

I have no idea where I can find a windows 7 test computer, VM, or CI server (suggestions welcome), so this is the only way I can think of to try out a fix.

@mischnic
Copy link
Member

mischnic commented Nov 5, 2021

You can download official Windows 7, 8 and 10 test VMs here: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

@kriszyp
Copy link
Contributor

kriszyp commented Nov 5, 2021

You can download official Windows 7...

@mischnic Thank you, this is perfect for testing! (I don't know why I could never find this in my googling efforts, I did look for it).

Anyway, I was indeed able to reproduce this issue and verify that my fix does indeed fix the issue! I will publish a new version (point release) with this fix.

One other question: I assume you are using 64-bit windows 7, right? I ask because the VM I downloaded was 32-bit, and I could include some 32-bit binaries, but I assume that is exceedingly rare now, and from what I can tell, parcel only ships 64-bit prebuild binaries (in transformer-js) as well, so I don't know if there would be any point in including prebuild windows 32-bit binaries?

@Biosphakus
Copy link
Author

Biosphakus commented Nov 5, 2021

@kriszyp Thanks a lot for helping with this issue! I've just tried your suggested fix but for me the issue remains with the error message unchanged. As you seem to have fixed it, it's probably just me getting something wrong in the process:

In the console at the path of my project:

npm install parcel --save-dev
npm install lmdb-store@1.6.12-min-win
node
require('lmdb-store')

Strg+D (switch back to console outside node)

npm run build

Could you elaborate on what is wrong here?
Indeed, I'm using 64-bit Windows, I've added this to the bug report.

@kriszyp
Copy link
Contributor

kriszyp commented Nov 5, 2021

@Biosphakus Are you still getting the error when you run/test require('lmdb-store') on its own? Or just when running the parcel build? This was just a test release so I could check to see if this fix worked, it doesn't actually change the lmdb-store version that parcel uses, since 1.6.12-min-win isn't considered a semantically compatible version. I guess you could force it by deleting your node_modules/@parcel/cache/node_modules/lmdb-store directory, but I will actually create a proper point release that should be a compatible version (assuming this is the proper fix). Anyway, I tested both node v12 and v14.16.1 on the win 7 vm, so I think my fix is working.

@Biosphakus
Copy link
Author

Biosphakus commented Nov 5, 2021

@kriszyp Ah, I see. I get the error just when trying to run parcel build. Otherwise it seems fine:

node
Welcome to Node.js v14.16.1.
Type ".help" for more information.
> require('lmdb-store')
{
  Compression: [Function: Compression],
  Env: [Function: Env],
  Cursor: [Function: Cursor],
  version: {
    versionString: 'LMDB 0.9.90: (May 1, 2017)',
    major: 0,
    minor: 9,
    patch: 90
  },
  getLastVersion: [Function: getLastVersion],
  setLastVersion: [Function: setLastVersion],
  lmdbError: [Function: lmdbError],
  bufferToKeyValue: [Function: bufferToKeyValue],
  keyValueToBuffer: [Function: keyValueToBuffer],
  getAddress: [Function: getAddress],
  lmdbNativeFunctions: [Function: lmdbNativeFunctions],
  allDbs: Map(0) {},
  open: [Function: open],
  ABORT: {},
  compareKey: [Function: compareKey],
  getLastEntrySize: [Function (anonymous)]
}

I think I should wait for the final version then :)

@kriszyp
Copy link
Contributor

kriszyp commented Nov 5, 2021

Ok, published v1.6.13 with this fix, so you should be able to upgrade or reinstall to upgrade to this version.

@Biosphakus
Copy link
Author

Thank you very much! Unfortunately, it still does not work for me but the error message is different.

Console

$ npm run build

> project_test@1.0.0 build
> echo Trying to build && parcel build --public-url index.html

Trying to build
× Build failed.

unknown: Could not find entry: C:\xampp\htdocs\Project_Test\.

index.html

<!DOCTYPE html>
<html lang="en">

  <head>
      <meta charset="utf-8">
      <title>Test</title>
  </head>


  <body>
    Hello World!
    <script type="module" src="test.js"></script>
  </body>
</html>

test.js

alert("test!");

package.json

{
  "name": "project_test",
  "version": "1.0.0",
  "description": "Test for parcel",
  "main": "index.html",
  "scripts": {
    "build": "echo Trying to build && parcel build --public-url index.html",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "parcel": "^2.0.0"
  },
  "dependencies": {
    "lmdb-store": "^1.6.13"
  }
}

Maybe the error is on my end?

@mischnic
Copy link
Member

mischnic commented Nov 8, 2021

  1. You should remove "main": "index.html"
  2. Either do parcel build --public-url /some/url index.html or just parcel build index.html

@Biosphakus
Copy link
Author

It's working now!

1. You should remove `"main": "index.html"`

This solved the build error ...

2. Either do `parcel build --public-url /some/url index.html`  or just `parcel build index.html`

... and this helped me to make the test.js file work. As it is in the same directory as the index.html, I had to use parcel build --public-url . index.html.

Thanks again!

@brianmbe
Copy link

I removed "main": "index.html" and now building💪💪

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

4 participants