Repository navigation
Description
Please ensure:
- The bug is caused by Refined GitHub. It doesn't happen if I disable the extension.
Example URLs
N/A
Browser(s) used
N/A
Description
Following the instructions on a up to date Win10 machine with Node 16.6 and using the lastest commit in the main (as of a few minutes ago), when I run npm run watch (or npm run build) I get the following error and no output in the distribution/build folder.
C:\git\refined-github>npm run watch
> watch
> run-p watch:* --continue-on-error
> watch:typescript
> tsc --noEmit --watch --preserveWatchOutput
> watch:webpack
> cross-env NODE_OPTIONS='--loader ts-node/esm' webpack --mode=development --watch
The system cannot find the path specified.
node:events:371
throw er; // Unhandled 'error' event
^
Error: spawn ts-node\esm ENOENT
at notFoundError (C:\git\refined-github\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\git\refined-github\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\git\refined-github\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.cp.emit (C:\git\refined-github\node_modules\cross-spawn\lib\enoent.js:30:37)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn ts-node\\esm',
path: 'ts-node\\esm',
spawnargs: [ 'webpack', '--mode=development', '--watch' ]
}
[6:25:08 PM] Starting compilation in watch mode...
[6:25:16 PM] Found 0 errors. Watching for file changes.
After poking around a bit I found that, ironically, it's the use of cross-env in package.json that's causing the problem. Specifically the use of single quotes (') to delimit the NODE_OPTIONS. Updating the relevant lines in package.json as follows addresses the error. Note the use of \" instead of '.
"build:webpack": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" webpack --mode=production",
"watch:webpack": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" webpack --mode=development --watch"
With that change, the build seems to progress though now there is a new error reported as follows:
C:\git\refined-github>npm run watch
> watch
> run-p watch:* --continue-on-error
> watch:typescript
> tsc --noEmit --watch --preserveWatchOutput
> watch:webpack
> cross-env NODE_OPTIONS="--loader ts-node/esm" webpack --mode=development --watch
(node:7768) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
[6:26:04 PM] Starting compilation in watch mode...
refined-github.css ⏤ 15.3 kB (+15.3 kB)
refined-github.js ⏤ 244 kB (+244 kB)
background.js ⏤ 30.8 kB (+30.8 kB)
options.css ⏤ 2.58 kB (+2.58 kB)
options.js ⏤ 36.8 kB (+36.8 kB)
resolve-conflicts.js ⏤ 2.55 kB (+2.55 kB)
browser-polyfill.js ⏤ 7.79 kB (+7.79 kB)
ERROR in ./readme.md 1:1
Module parse failed: Unexpected character ' ' (1:1)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> # <img src="distribution/icon.png" width="45" align="left"> Refined GitHub
|
| > Browser extension that simplifies the GitHub interface and adds useful features
[6:26:14 PM] Found 0 errors. Watching for file changes.
While there's an ERROR in the text of the log, the output also notes Found 0 errors.
It appears that when I run the extension on Chrome it is failing early with a similar error (below) and my feature init functions are not being called.
refined-github.js:20699 Uncaught Error: Module parse failed: Unexpected character ' ' (1:1)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> # <img src="distribution/icon.png" width="45" align="left"> Refined GitHub
|
| > Browser extension that simplifies the GitHub interface and adds useful features
at Object../readme.md (refined-github.js:20699:7)
at __webpack_require__ (refined-github.js:23569:42)
at Module../source/helpers/bisect.tsx (refined-github.js:1788:68)
at __webpack_require__ (refined-github.js:23569:42)
at Module../source/features/index.tsx (refined-github.js:663:73)
at __webpack_require__ (refined-github.js:23569:42)
at Module../source/features/extendo-log.tsx (refined-github.js:212:59)
at __webpack_require__ (refined-github.js:23569:42)
at refined-github.js:23652:79
at refined-github.js:23663:3
Include in this issue:
- Screenshots/video/gif demonstrating the bug, if it’s visual
- Console errors, if any
Activity
jeffmcaffer commentedon Jan 8, 2022
bit of followup. I tried this all on an Ubuntu 20.4 machine with Node 14 and it seems to work (though I've not run the built extension).
kidonng commentedon Jan 8, 2022
fregante commentedon Jan 8, 2022
Thanks for the issue. Single quotes are not supported on Windows, so please send a PR to fix that.
We are running two builds at once:
"Found 0 errors" is TypeScript.
We use a custom loader to parse the readme.md file. I'm not sure why it's being ignored for you
refined-github/webpack.config.ts
Lines 31 to 32 in e22b079
fregante commentedon Jan 8, 2022
Could it be cause
/readme.mdis actually\readme.mdon windows and therefore the regex doesn't work? It'd be strange if Webpack didn't normalize this…yakov116 commentedon Jan 9, 2022
Been meaning to open an issue I have not been able to compile too. (One of the many reasons I have not been so active )
I am almost sure I have which commit caused the issue I will double check tomorrow.
fregante commentedon Jan 9, 2022
Let's also add a CI build on Windows to ensure we don't involuntary break it in the future. It can be done via matrix
kidonng commentedon Jan 9, 2022
Unfortunately, yes: webpack/webpack#5327
#5049?
jeffmcaffer commentedon Jan 10, 2022
awesome. Thanks
Terbiy commentedon Apr 27, 2024
Hello! I came here from the Internet to say thank you for @jeffmcaffer for discovering how to fix the
cross-envENOENTproblem.