others-Guide of installing hoppscotch app
1. Purpose
In this post, I would demo how to install the hoppscotch app in macos. And I would try to demo how to solve the installation problems I encountered when I tried to install the app.
2. Environement
- OS: MacOs 10.15
- NodeJS version: Node.js v17.1.0
- npm version:
{
npm: '8.1.2',
node: '17.1.0',
v8: '9.5.172.25-node.13',
uv: '1.42.0',
zlib: '1.2.11',
brotli: '1.0.9',
ares: '1.18.1',
modules: '102',
nghttp2: '1.45.1',
napi: '8',
llhttp: '6.0.4',
openssl: '3.0.0+quic',
cldr: '39.0',
icu: '69.1',
tz: '2021a',
unicode: '13.0',
ngtcp2: '0.1.0-DEV',
nghttp3: '0.1.0-DEV'
}
3. Solution
3.1 What is hoppscotch app?
Hoppscotch is just a tool that helps you create http/https requests faster, saving precious time on development.
Hoppscotch is light-weight, web based API development suite. It was built from ground up with ease of use and accessibility in mind providing all the functionality needed for API developers with minimalist, unobtrusive UI. It is free-to-use and as an added perk completely Open Source!
The author of hoppscotch(Liyas Thomas) write an article about why he creates the app. He wrote:
The story behind Hoppscotch: The very first task I was assigned is an API integration of an old project. Thatโs when I came across Postman API testing tool. Postman has separate builds targeted to each operating system made with Electron. I use a low-end PC and canโt possibly afford to run another Electron app. From that moment onwards, I wanted to make an API testing platform which is:
- Open Sourced ๐
- Runs online
- Have multi-platform support
- Have multi-device support
- Accessible from anywhere
3.2 Why do I want to install this app?
Because I am tired of using postman , I want something new and open source,and it can :
- Send requests to verify your API is ready for launch GET, PUT, POST, DELETE, OPTIONS (more coming soon)
- Authentication support
- Parameters support
- Request body support
- View Response
- Progressive Web App support
3.3 Some basic/background knowledge needed to learn to do this job
3.3.1 pnpm
pnpm
pnpm is an alternative package manager for Node.js. It is a drop-in replacement for npm, but faster and more efficient.
The main benefit of pnpm
is the disk-saving technology that it uses:
pnpm uses a content-addressable filesystem to store all files from all module directories on a disk. When using npm or Yarn, if you have 100 projects using lodash, you will have 100 copies of lodash on disk. With pnpm, lodash will be stored in a content-addressable storage, so:
- If you depend on different versions of lodash, only the files that differ are added to the store. If lodash has 100 files, and a new version has a change only in one of those files,
pnpm update
will only add 1 new file to the storage.- All the files are saved in a single place on the disk. When packages are installed, their files are linked from that single place consuming no additional disk space. Linking is performed using either hard-links or reflinks (copy-on-write).
As a result, you save gigabytes of space on your disk and you have a lot faster installations! If youโd like more details about the unique
node_modules
structure that pnpm creates and why it works fine with the Node.js ecosystem, read this small article: Flat node_modules is not the only way.
You can install pnpm using npm as follows:
npm install -g pnpm
Or install from scratch(no npm installed):
curl -fsSL https://get.pnpm.io/install.sh | sh -
Usage of pnpm(As opposed to npm):
3.4 The installation process and the problem/errors I encountered
3.4.1 Download source code
You can download it from its github repository: https://github.com/hoppscotch/hoppscotch , here is the command:
git clone https://github.com/hoppscotch/hoppscotch.git
After download, you get this directory structure:
โ hoppscotch tree -d ./hoppscotch -L 1
./hoppscotch
โโโ node_modules
โโโ packages
2 directories
3.4.2 build from source code
Now we can use pnpm
to install the dependencies of hoppscotch.
First we need to install pnpm
(Read more about pnpm) :
npm install -g pnpm
Then we can use it to install hoppscotch dependencies (Execute it inside root direcotry of hoppscotch ):
pnpm install
3.4.3 generate the release package
After installing the dependencies , we can build the app now:
$ pnpm run build
โ > @hoppscotch/[email protected] build /Users/bswen/Downloads/hoppscotch/
โ > npx tsc
โโ Done in 6.8s
packages/hoppscotch-app do-build-prod$ pnpm run generate
โ > [email protected] generate /Users/bswen/Downloads/hoppscotch/hopps
โ > nuxt generate --modern
โ WARN No .env file found in /Users/bswen/Downloads/hoppscotch/hoppscot
โ WARN Modules should be only specified once: unplugin-vue2-script-setup/nux
โ โน Production build
โ โน Bundling only for client side
โ โน Target: static
โ โน Using components loader to optimize imports
โ โน Discovered Components: node_modules/.cache/nuxt/components/readme.md
โ โ Builder initialized
โ โ Nuxt files generated
โ โน Compiling Client
โ ERROR Error: error:0308010C:digital envelope routines::unsupported
โ at new Hash (node:internal/crypto/hash:67:19)
โ at Object.createHash (node:crypto:130:10)
โ at module.exports (/Users/bswen/Downloads/hoppscotch/hoppscotch-2.1
โ at NormalModule._initBuildHash (/Users/bswen/Downloads/hoppscotch/h
โ at handleParseError (/Users/bswen/Downloads/hoppscotch/hoppscotch-2
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/
โ at iterateNormalLoaders (/Users/bswen/Downloads/hoppscotch/hoppscot
โ at iterateNormalLoaders (/Users/bswen/Downloads/hoppscotch/hoppscot
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/
โ at runSyncOrAsync (/Users/bswen/Downloads/hoppscotch/hoppscotch-2.1
โ at iterateNormalLoaders (/Users/bswen/Downloads/hoppscotch/hoppscot
โ at Array.<anonymous> (/Users/bswen/Downloads/hoppscotch/hoppscotch-
โ at Storage.finished (/Users/bswen/Downloads/hoppscotch/hoppscotch-2
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/
โ ERROR error:0308010C:digital envelope routines::unsupported
โ at new Hash (node:internal/crypto/hash:67:19)
โ at Object.createHash (node:crypto:130:10)
โ at module.exports (/Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0
โ at NormalModule._initBuildHash (/Users/bswen/Downloads/hoppscotch/hop
โ at handleParseError (/Users/bswen/Downloads/hoppscotch/hoppscotch-2.1
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.p
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.p
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.p
โ at iterateNormalLoaders (/Users/bswen/Downloads/hoppscotch/hoppscotch
โ at iterateNormalLoaders (/Users/bswen/Downloads/hoppscotch/hoppscotch
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.p
โ at context.callback (/Users/bswen/Downloads/hoppscotch/hoppscotch-2.1
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.p
โ /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.pnpm/l
โ throw e;
โ ^
โ Error: error:0308010C:digital envelope routines::unsupported
โ at new Hash (node:internal/crypto/hash:67:19)
โ at Object.createHash (node:crypto:130:10)
โ at module.exports (/Users/bswen/Downloads/hoppscotch/hoppscotch-2.1
โ at NormalModule._initBuildHash (/Users/bswen/Downloads/hoppscotch/h
โ at handleParseError (/Users/bswen/Downloads/hoppscotch/hoppscotch-2
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/
โ at iterateNormalLoaders (/Users/bswen/Downloads/hoppscotch/hoppscot
โ at iterateNormalLoaders (/Users/bswen/Downloads/hoppscotch/hoppscot
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/
โ at context.callback (/Users/bswen/Downloads/hoppscotch/hoppscotch-2
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/
โ at /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/
โ at FSReqCallback.oncomplete (node:fs:188:23) {
โ opensslErrorStack: [ 'error:03000086:digital envelope routines::initializa
โ library: 'digital envelope routines',
โ reason: 'unsupported',
โ code: 'ERR_OSSL_EVP_UNSUPPORTED'
โ }
โ Node.js v17.1.0
โ โELIFECYCLEโ Command failed with exit code 1.
โโ Failed in 19.3s
/Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/packages/hoppscotch-app:
โERR_PNPM_RECURSIVE_RUN_FIRST_FAILโ [email protected] do-build-prod: `pnpm run generate`
Exit status 1
โELIFECYCLEโ Command failed with exit code 1.
The core error message is:
ERROR Error: error:0308010C:digital envelope routines::unsupported
After searching, I found that this error is caused by the incompatibility of the installation process and the https/ssl verification. So I do this:
โ hoppscotch-2.1.0 export NODE_OPTIONS=--openssl-legacy-provider
According to the nodejs document, this option is used to:
--openssl-legacy-provider
#Added in: v17.0.0
Enable OpenSSL 3.0 legacy provider. For more information please see OSSL_PROVIDER-legacy.
Now run the build command again:
โ hoppscotch-2.1.0 pnpm run generate
> [email protected] generate /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0
> pnpm -r do-build-prod
Scope: all 3 workspace projects
packages/hoppscotch-js-sandbox do-build-prod$ pnpm run build
โ > @hoppscotch/[email protected] build /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/packages/hopp
โ > npx tsc
โโ Done in 5.9s
packages/hoppscotch-app do-build-prod$ pnpm run generate
โ > [email protected] generate /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/packages/hoppscotc
โ > nuxt generate --modern
โ WARN No .env file found in /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/packages/hoppscotch-a
โ WARN Modules should be only specified once: unplugin-vue2-script-setup/nuxt
โ โน Production build
โ โน Bundling only for client side
โ โน Target: static
โ โน Using components loader to optimize imports
โ โน Discovered Components: node_modules/.cache/nuxt/components/readme.md
โ โ Builder initialized
โ โ Nuxt files generated
โ โน Compiling Client
โ ERROR [BABEL] Note: The code generator has deoptimised the styling of /Users/bswen/Downloads/hoppsc
โ ERROR [BABEL] Note: The code generator has deoptimised the styling of /Users/bswen/Downloads/hoppsc
โ โ Client: Compiled successfully in 1.26m
โ โน Compiling Modern
โ ERROR [BABEL] Note: The code generator has deoptimised the styling of /Users/bswen/Downloads/hoppsc
โ ERROR [BABEL] Note: The code generator has deoptimised the styling of /Users/bswen/Downloads/hoppsc
โ โ Modern: Compiled successfully in 1.06m
โ Hash: b1330a9f2967d6361eb4
โ Version: webpack 4.46.0
โ Time: 75327ms
โ Built at: 11/23/2021 11:17:54 AM
โ Asset Size
โ ../server/client.manifest.json 60.9 KiB
โ 026633b.js 7.46 KiB
โ 029f9a0.js 40.8 KiB
โ 037c3a7.js 2.77 KiB
โ .....
โ fd5acbc.worker.js 32 KiB
โ fdc132f.js 142 KiB
โ ff0c590.js 777 bytes
โ fff3096.js 14 KiB
โ + 1 hidden asset
โ Entrypoint app [big] = 754963b.js a352673.js c6ff85f.js 068d1fe.js
โ WARNING in /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.pnpm/[email protected]/
โ Critical dependency: the request of a dependency is an expression
โ @ ./helpers/curlparser.ts
โ @ /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.pnpm/[email protected].
โ @ ./components/http/ImportCurl.vue?vue&type=script&lang=ts&
โ @ ./components/http/ImportCurl.vue
โ @ ./node_modules/.cache/nuxt/components/index.js
โ @ ./node_modules/.cache/nuxt/components/plugin.js
โ @ ./node_modules/.cache/nuxt/index.js
โ @ ./node_modules/.cache/nuxt/client.js
โ @ multi /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.pnpm/@[email protected]
โ WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
โ This can impact web performance.
โ Assets:
โ 3804ee4.js (441 KiB)
โ 068d1fe.js (428 KiB)
โ a352673.js (248 KiB)
โ f6adfe7.js (353 KiB)
โ 70c6fda.js (1.3 MiB)
โ 4b6b14a.js (402 KiB)
โ 13676bc.js (1.92 MiB)
โ c6ff85f.js (1.1 MiB)
โ WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended
โ Entrypoints:
โ app (1.76 MiB)
โ 754963b.js
โ a352673.js
โ c6ff85f.js
โ 068d1fe.js
โ
โ Hash: 59b3d54356a5ed443ae9
โ Version: webpack 4.46.0
โ Time: 63873ms
โ Built at: 11/23/2021 11:18:58 AM
โ Asset Size
โ ../server/modern.manifest.json 60.5 KiB
โ
โ 1735f33.modern.js 43.2 KiB
โ 1a93978.modern.js 39.9 KiB
โ 1b89a41.modern.js 940 bytes
โ ......
โ f52d88c.modern.js 4.6 KiB
โ f61d836.modern.js 12.7 KiB
โ f6f7bb7.modern.js 26.6 KiB
โ f9a007f.modern.js 1010 bytes
โ fb60cb1.modern.js 2.78 KiB
โ fe8bd15.modern.js 21.8 KiB
โ + 1 hidden asset
โ Entrypoint app [big] = 43030c1.modern.js ab5b9d2.modern.js 5b912c0.modern.js 1ca25e5.modern.js
โ WARNING in /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.pnpm/[email protected]/
โ Critical dependency: the request of a dependency is an expression
โ @ ./helpers/curlparser.ts
โ @ /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.pnpm/[email protected].
โ @ ./components/http/ImportCurl.vue?vue&type=script&lang=ts&
โ @ ./components/http/ImportCurl.vue
โ @ ./node_modules/.cache/nuxt/components/index.js
โ @ ./node_modules/.cache/nuxt/components/plugin.js
โ @ ./node_modules/.cache/nuxt/index.js
โ @ ./node_modules/.cache/nuxt/client.js
โ @ multi /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/node_modules/.pnpm/@[email protected]
โ WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
โ This can impact web performance.
โ Assets:
โ 0184baf.modern.js (442 KiB)
โ 1ca25e5.modern.js (405 KiB)
โ 231f202.modern.js (331 KiB)
โ 8489405.modern.js (1.27 MiB)
โ 02019ce.modern.js (380 KiB)
โ 55f3515.modern.js (1.89 MiB)
โ 5b912c0.modern.js (1.07 MiB)
โ WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended
โ Entrypoints:
โ app (1.68 MiB)
โ 43030c1.modern.js
โ ab5b9d2.modern.js
โ 5b912c0.modern.js
โ 1ca25e5.modern.js
โ
โ WARN No .env file found in /Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/packages/hoppscotch-a
โ WARN Modules should be only specified once: unplugin-vue2-script-setup/nuxt
โ โน Generating pages
โ โ Generated route "/ar"
โ โ Generated route "/cs"
โ โ......
โ โ Generated route "/sr/realtime"
โ โ Generated route "/vi/join-team"
โ โ Generated route "/vi/settings"
โ โ Generated route "/tw/settings"
โ โ Generated route "/"
โ โ Client-side fallback created: 404.html
โ โน Generating sitemaps
โ FATAL [sitemap-module] The hostname option is mandatory in your config on spa or generate build mode
โ {
โ "path": "/sitemap.xml",
โ "exclude": [],
โ "routes": [],
โ "cacheTime": 900000,
โ "etag": {
โ "weak": false
โ },
โ "gzip": false,
โ "trailingSlash": false,
โ "defaults": {},
โ "pathGzip": "/sitemap.xml"
โ }
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎโ
โ โELIFECYCLEโ Command failed with exit code 1.
โโ Failed in 2m 31.7s
/Users/bswen/Downloads/hoppscotch/hoppscotch-2.1.0/packages/hoppscotch-app:
โERR_PNPM_RECURSIVE_RUN_FIRST_FAILโ [email protected] do-build-prod: `pnpm run generate`
Exit status 1
โELIFECYCLEโ Command failed with exit code 1.
โ hoppscotch-2.1.0
It failed again, the core error message is:
FATAL [sitemap-module] The hostname option is mandatory in your config on spa or generate build mode
After searching, I found this answer from liyasthomas :
This seems like an issue of not having a
.env
file inpackages/hoppscotch-app
directory.Rename the default
.env.example
file found inpackages/hoppscotch-app
to.env
and run the generate command again.For self-hosting, you can provide your own environment keys in
.env
.Let me know if this doesnโt fix your issue.
So I do this:
โ hoppscotch git:(main) cd packages
โ packages git:(main) cd hoppscotch-app
โ hoppscotch-app git:(main) cp .env.example .env
Then run the build command again:
โ hoppscotch-2.1.0 pnpm run generate
It succeeded! We got a dist directory:
โ hoppscotch-app git:(main) tree -d ./dist -L 1
./dist
โโโ _nuxt
โโโ af
โโโ ar
โโโ ca
โโโ cn
โโโ cs
โโโ da
โโโ de
โโโ documentation
โโโ el
โโโ enter
โโโ es
โโโ fi
โโโ fr
โโโ graphql
โโโ he
โโโ hu
โโโ images
โโโ it
โโโ ja
โโโ join-team
โโโ ko
โโโ nl
โโโ no
โโโ pl
โโโ profile
โโโ pt
โโโ pt-br
โโโ realtime
โโโ ro
โโโ ru
โโโ settings
โโโ sr
โโโ sv
โโโ tr
โโโ tw
โโโ uk
โโโ vi
3.4.4 Start the app
Now we can start hoppscotch app as follows:
โ hoppscotch-app git:(main) pwd
/Users/bswen/Downloads/hoppscotch/hoppscotch
โ hoppscotch git:(main) pnpm run dev
> [email protected] dev /Users/bswen/Downloads/hoppscotch/hoppscotch
> pnpm -r do-dev
Scope: all 4 workspace projects
packages/hoppscotch-app do-dev$ pnpm run dev
[124 lines collapsed]
โ [dev:nuxt ] WARN Compiled with 1 warnings
โ [dev:nuxt ]
โ [dev:nuxt ]
โ [dev:nuxt ] WARN in /Users/bswen/Downloads/hoppscotch/hoppscotch/node_modules/.pnpm/[email protected]/node_modules/yargs-parser/build/lib/index.js
โ [dev:nuxt ]
โ [dev:nuxt ] Critical dependency: the request of a dependency is an expression
โ [dev:nuxt ]
โ [dev:nuxt ] โน Waiting for file changes
โ [dev:nuxt ] โน Memory usage: 608 MB (RSS: 1.15 GB)
โ [dev:nuxt ] โน Listening on: http://10.28.145.223:3000/
โโ Running...
3.5 The success
Now letโs try the app , send a http request to test it. Letโs open a browser and goto : http://localhost:3000, we get this:
It works!
4. Summary
In this post, I demonstrated how to install hoppscotch app and how to resovle issues when installing it. Thatโs it, thanks for your reading.