jeromepl / highlighter

A Chrome extension to highlight text and keep it all saved
MIT License
308 stars 77 forks source link

Error: Cannot find module './package.json #31

Closed yuis-ice closed 2 years ago

yuis-ice commented 2 years ago

I'm trying to build a release by npm run release as documented, but I get Error: Cannot find module './package.json.

versions:

$ node -v
v16.13.2

$ npm -v
8.1.2

reproduction:

$ git clone https://github.com/jeromepl/highlighter.git
$ cd highlighter
$ npm i 

$ npm run-script release

> highlighter@3.1.2 release
> node scripts/release.js

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module './package.json'
Require stack:
- /home/user/pg/highlighter/scripts/release.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/user/pg/highlighter/scripts/release.js:9:21)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/user/pg/highlighter/scripts/release.js' ]
}

Thanks.

jeromepl commented 2 years ago

Hi!

There was indeed a bug in this file since I moved it to a scripts folder, thanks for the report!

I also fixed a couple more issues with the script as I had to use it for the first time to create a draft release of version 4.0.0 Be aware that this release script is mostly for my personal use (but should work for any fork of the project).

If you simply want to generate a zip file that you can then manually load in your browser the script can be used but you will have to comment-out some lines that are creating git commits, pushing to the remote repository and creating a draft release. Unfortunately at the moment there is no configurable option to be able to skip those steps easily

yuis-ice commented 2 years ago

Hello. Thanks for the clarification. I wanted to have a release by building manually because I wanted to have a new feature, the iframe implementation as mentioned here Issue #12 · jeromepl/highlighter. Since on the chrome web store the latest release is February 10, 2021, we need to build manually from the source code, I thought. no?

So from the fact building a release from the source is not simple as it sounds, I'd better wait for the new v4 release on the chrome web store?

jeromepl commented 2 years ago

Waiting for the next release is definitely the easiest option. I'm currently doing the final tests of v4 and plan on releasing next weekend 🙂

jeromepl commented 2 years ago

Just wanted to add: if you need this before the official release, you should be able to use it in chrome by cloning this repo (or downloading the zip file containing all the code) and going to chrome://extensions/ and clicking "Load unpacked" where you can select the folder containing all the code. I believe this should work without any changes but I haven't personally tested it