question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

build fails on Windows

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
yakov116commented, 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.

1reaction
fregantecommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

build error on windows #3568 - google/mediapipe - GitHub
Describe the problem: When ran the follow command on windows, errors occured! I followed the official document. Can not find any solutions.
Read more >
Project build errors and warnings (PRJxxxx) - Microsoft Learn
The Visual Studio compilers and build tools can report many kinds of errors and warnings. After an error or warning is found, the...
Read more >
Stop Killing Your FPS PC Build FAILS | Boost My Build S2:E15
Exploding PSU, Bad GPU, Wrong Motherboard, Not Enough Cooling - the list goes on! We fix the PC Build Fails and get you...
Read more >
Docker Build Fails on Windows? - Stack Overflow
But on Windows 11 (PowerShell as administrator) I'm getting the following error: PS C:\> docker build -t ubuntu-docker:v1.0.2 ./ Get-Process : A ...
Read more >
Common Build Problems - Travis CI Docs
Restart a build that used to be green, the last known working one, for instance. If that build suddenly fails too, there's a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found