MetaMask / MetaMask/metamask-extension

Difficulties to build metamask-extension on Windows OS

Open
#22,753 0 comments 0 reactions 0 assignees View on GitHub
external-contributor
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

### What is this about?

Many times I tried to build metamask-extension on Windows OS (Win10) but every time got the same result like below.

```sh
E:\project\sandbox\metamask-extension>yarn start
Building lavamoat runtime file (scuttling is off)
Running task "dev"...
Starting 'dev'...
Starting 'clean'...
Finished 'clean'
Starting 'styles:dev'...
Finished 'styles:dev'
Starting 'scripts:core:dev:standardEntryPoints'...
Starting 'scripts:core:dev:contentscript'...
Starting 'scripts:core:dev:disable-console'...
Starting 'scripts:core:dev:sentry'...
Starting 'static:dev'...
Starting 'manifest:dev'...
Starting 'reload'...
Finished 'reload'
Finished 'manifest:dev'
scripts:core:dev:disable-console: Bundle start: "disable-console"
scripts:core:dev:contentscript: Bundle start: "inpage"
scripts:core:dev:sentry: Bundle start: "sentry-install"
scripts:core:dev:standardEntryPoints: Bundle start: "primary"
scripts:core:dev:disable-console: Bundle end: "disable-console"
scripts:core:dev:contentscript: Bundle end: "inpage"
scripts:core:dev:contentscript: Bundle start: "contentscript"
scripts:core:dev:sentry: Bundle end: "sentry-install"
scripts:core:dev:contentscript: Bundle end: "contentscript"
scripts:core:dev:standardEntryPoints: TypeError: Tried to access an environmental variable "_nodeLRUCacheForceNoSymbol" that wasn't declared in builds.yml
Why am I seeing this: We've made use of new variables be explicit to keep track of all of them in one place
How do I fix this: Adding your variable in builds.yml under "env" property and committing to git will fix this
at Variables.getMaybe (E:\project\sandbox\metamask-extension\development\lib\variables.js:52:7)
at Variables.get (E:\project\sandbox\metamask-extension\development\lib\variables.js:28:24)
at Object.get (E:\project\sandbox\metamask-extension\development\build\scripts.js:1319:26)
at getReplacementString (E:\project\sandbox\metamask-extension\node_modules\loose-envify\replace.js:56:19)
at replace (E:\project\sandbox\metamask-extension\node_modules\loose-envify\replace.js:28:25)
at LooseEnvify._flush (E:\project\sandbox\metamask-extension\node_modules\loose-envify\loose-envify.js:33:18)
at LooseEnvify.final [as _final] (node:internal/streams/transform:132:10)
at callFinal (node:internal/streams/writable:698:12)
at prefinish (node:internal/streams/writable:710:7)
at finishMaybe (node:internal/streams/writable:720:5)
at Writable.end (node:internal/streams/writable:634:5)
at DuplexWrapper. (E:\project\sandbox\metamask-extension\node_modules\duplexer2\index.js:29:14)
at Object.onceWrapper (node:events:628:28)
at DuplexWrapper.emit (node:events:526:35)
at finishMaybe (E:\project\sandbox\metamask-extension\node_modules\readable-stream\lib\_stream_writable.js:630:14)
at endWritable (E:\project\sandbox\metamask-extension\node_modules\readable-stream\lib\_stream_writable.js:638:3)
at Writable.end (E:\project\sandbox\metamask-extension\node_modules\readable-stream\lib\_stream_writable.js:594:22)
at DestroyableTransform.onend (E:\project\sandbox\metamask-extension\node_modules\readable-stream\lib\_stream_readable.js:577:10)
at Object.onceWrapper (node:events:628:28)
at DestroyableTransform.emit (node:events:526:35)
at endReadableNT (E:\project\sandbox\metamask-extension\node_modules\readable-stream\lib\_stream_readable.js:1010:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
filename: 'E:\\project\\sandbox\\metamask-extension\\node_modules\\react-devtools-core\\dist\\backend.js',
stream: Labeled {
_readableState: ReadableState {
objectMode: true,
highWaterMark: 16,
buffer: BufferList { length: 0 },
length: 0,
pipes: [Labeled],
pipesCount: 1,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null
},
readable: true,
_events: [Object: null prototype] {
end: [Array],
error: [Function (anonymous)],
data: [Function: ondata],
_mutate: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: true,
highWaterMark: 16,
finalCalled: false,
needDrain: false,
ending: true,
ended: true,
finished: true,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function (anonymous)],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: true,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [CorkedRequest]
},
writable: false,
allowHalfOpen: true,
_options: { objectMode: true },
_wrapOptions: { objectMode: true },
_streams: [ [Deps], [Transform] ],
length: 2,
label: 'deps',
[Symbol(kCapture)]: false
}
}
scripts:core:dev:standardEntryPoints: Finished 'static:dev'
```

And then it doesn't make any more print.

Is this problem for only Windows OS or any other OSs like Linux & Mac?

### Scenario

_No response_

### Design

_No response_

### Technical Details

_No response_

### Threat Modeling Framework

_No response_

### Acceptance Criteria

_No response_

### Stakeholder review needed before the work gets merged

- [x] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [X] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)

### References

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with yarn start on Windows, then start with development/lib/variables.js and development/build/scripts.js, following the stack trace to the undeclared environment variable. Compare the referenced builds.yml configuration with the build output and verify that the development build proceeds beyond standardEntryPoints without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.