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

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

Closed
yuis-ice opened this issue Feb 5, 2022 · 4 comments
Closed

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

yuis-ice opened this issue Feb 5, 2022 · 4 comments
Assignees

Comments

@yuis-ice
Copy link

yuis-ice commented Feb 5, 2022

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 jeromepl self-assigned this Feb 6, 2022
@jeromepl
Copy link
Owner

jeromepl commented Feb 6, 2022

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
Copy link
Author

yuis-ice commented Feb 7, 2022

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
Copy link
Owner

jeromepl commented Feb 7, 2022

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
Copy link
Owner

jeromepl commented Feb 7, 2022

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

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

2 participants