Comments (14)
I tried to install pagefind on Windows 10 with 4 different shells: cmd, Powershell, git bash, cygwin bash.
For each of the cases, I created a new NPM package using npm init
and accepting all defaults.
With cmd and Powershell, installation worked fine (node_modules was created, pagefind folder exists).
On both git bash and cygwin bash, I got similar error messages:
$ npm install --save-dev pagefind
npm ERR! code 1
npm ERR! path C:\Users\tg\pagefind\gitbash\node_modules\pagefind
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./lib/postinstall.js
npm ERR! Finding release for v0.8.0
npm ERR! https://api.github.com/repos/CloudCannon/pagefind/releases/tags/v0.8.0
npm ERR! GET https://api.github.com/repos/CloudCannon/pagefind/releases/tags/v0.8.0
npm ERR! Downloading from https://api.github.com/repos/CloudCannon/pagefind/releases/assets/75547266
npm ERR! Downloading to C:\Users\tg\pagefind\gitbash\node_modules\pagefind\cache\0.8.0\pagefind_extended-v0.8.0-x86_64-pc-windows-msvc.tar.gz
npm ERR! Downloading with Invoke-WebRequest
npm ERR! Unzipping to C:\Users\tg\pagefind\gitbash\node_modules\pagefind\bin
npm ERR! tar xvf exited with 128
npm ERR! Deleting invalid download
npm ERR! tar: Cannot connect to C: resolve failed
npm ERR! Downloading pagefind failed: Error: tar xvf exited with 128
npm ERR! at ChildProcess.<anonymous> (C:\Users\tg\pagefind\gitbash\node_modules\pagefind\lib\download.js:217:24)
npm ERR! at ChildProcess.emit (node:events:390:28)
npm ERR! at maybeClose (node:internal/child_process:1064:16)
npm ERR! at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
Thus, it seems that the unpacking of the tar.gz file does not work on Windows with git bash/cygwin bash.
from pagefind.
When you rename pagefind_extended
to pagefind_extended.exe
, it works with cmd and Powershell, respectively:
from pagefind.
The reason why the .exe
extension is missing is that the tar files for Windows contain the executables without .exe
extension which does not fit together which what is implemented in
pagefind/wrappers/node/lib/index.js
Line 7 in 74aa99b
from pagefind.
Thanks for the deep dive @TimGeisler 🙏 I'm away from my keyboard this week but I will look at tidying that up when I'm back in a few days 🙂
It looks like changing the files in the tar archive to end in .exe
will fix one problem. Additionally the tar xvf
throwing an error needs to be looked into — I might swap that command out for a library like tar to try and sidestep any platform/shell specific errors.
from pagefind.
I have the same problem with Windows. Try to run directly the executable node_modules/pagefind/bin/pagefind_extended
.
from pagefind.
You mean npx run node_modules/pagefind/bin/pagefind
and then run it in my package.json? npx
, right?
from pagefind.
No, first install pagefind by adding it to your devDependencies. Then try to execute the executable in this folder directly (e.g. in your Powershell). That works for me.
However, we still need to find out the exact reason of the problems for Windows. There are more than one way where you can run the npx script: in cmd, in git bash, in cygwin, in PowerShell. I guess some parts of the extraction/recognition logic do not handle all those different settings. I need to find some time to look into that the next days.
from pagefind.
So, I did npm install pagefind --save-dev
and here it is in the package,json:
"devDependencies": {
"@11ty/eleventy": "^0.12.1",
"pagefind": "^0.8.0"
},
Then I had to cd
(3 times) down upto \node_modules\pagefind\bin
and run the binary directly ./pagefind_extended --source "_site"
But nothing happens, except a Windows prompt which asks me "How do you like to open this file?".
Obviously I'm doing something wrong,
PS I'm doing it in PowerShell.
from pagefind.
When I try to run the created file node_modules/pagefind/bin/pagefind_extended
in both cmd and Powershell, I get the behaviour which @rawriddims observed.
However, when I try to run these files with bash (git or cygwin), the executable is running:
Of course, you then have to specify the source folder, ...
from pagefind.
Unfortunately, I am not an expert to get those install/postinstall/... scripts working on all different shells on Windows. The combination of installing/unpacking with cmd/Powershell and running with bash worked for me. This helps for trying it out, but is not a solution if you develop on Windows.
from pagefind.
It's a bit too cumbersome for me, as I have to develop on Windows. Maybe I should wait for the .exe extension to be added to the Windows executables, or maybe for a plain Windows installation - if that's in the plans for the future. I look forward to see such developments of this excellent library. Thank you. And thank you very much @TimGeisler for the help and directions on how to proceed in my case.
from pagefind.
Sorry for the delay all — this should be fixed by #113 — aiming for a release this week 🙂
from pagefind.
👋 Hello! This is fixed in the Pagefind v0.9.1 release 🎉
from pagefind.
Thank you @TimGeisler 🙇 for solving the error I was encountering: Error: tar xvf exited with 128
With your comment above: #66 (comment)
Turns out I needed to run the npm install
command with Powershell rather than GitBash 😅
@bglw -- would you consider adding a note1 in the Installing and running Pagefind section of your website: https://pagefind.app/docs/installation/
In fact, I'm surprised you don't also share (for the new developers not familiar with all the npm
and node
stuff) that you can run npm install
and not just npx
🤔
Footnotes
-
Something like this: If you see an Error: tar xvf exited with 128 during installation, try using Powershell ❤️ ↩
from pagefind.
Related Issues (20)
- Configure max build file number HOT 2
- chore: update github action versions to handle node.js 16 deprecations HOT 2
- Use jieba to cut Chinese directly instead charabia HOT 3
- developer experience request: local build system
- Inconsistent search results HOT 1
- Exit code 101 "Permission denied" in CI HOT 2
- Issue with indexing and text that contains underscores HOT 2
- How to organize search into json file with the pagefind.js? HOT 1
- Does not build with rust 1.80.0 HOT 2
- Add in functionality for pages to be filtered only HOT 2
- Excerpts show "__PAGEFIND_ANCHOR__" HOT 4
- How to override URLs? HOT 1
- Security policy HOT 1
- How to use pagefind for a non-static website HOT 1
- exclude-selectors does not work HOT 1
- 'revfd' is declared but its value is never read HOT 1
- 'tds' is declared but its value is never read HOT 1
- incorrect search results for numbers HOT 1
- Node.js Search Example HOT 1
- How to run the integration tests locally HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pagefind.