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

Uncaught Error: Cannot find module 'electron-compile/lib/initialize-renderer' #619

Closed
trusktr opened this issue Nov 6, 2018 · 19 comments
Closed

Comments

@trusktr
Copy link

trusktr commented Nov 6, 2018

Node 10.9.0
NPM 6.4.1
electron-forge 5.2.2
macOS Mojave

Steps to reproduce:

electron-forge init test
cd test
npm install electron-forge
./node_modules/.bin/electron-force start

Open the console once the window appears to see the error:

screen shot 2018-11-06 at 12 18 21 pm

I can fix it by running npm install electron-compile in the project.

@malept
Copy link
Member

malept commented Nov 6, 2018

Why are you running npm install electron-forge? It should be installed in the project already.

I cannot reproduce this with Electron Forge 5.2.2:

npx --no-install --ignore-existing electron-forge init test
cd test
npm start

(If you don't have npx, upgrade NPM. npx was used so that it was obvious that the latest version of Electron Forge 5 was used, as opposed to an already installed version.)

@malept
Copy link
Member

malept commented Nov 14, 2018

Since the original issue reporter has not responded to the request for additional information in about a week, I'm going to assume that they either found the answer in another manner or decided not to pursue this issue. If I'm incorrect, they can respond with answers to the questions posed, and I'll reopen.

@malept malept closed this as completed Nov 14, 2018
@Stylesoftware
Copy link

Hiya,
I'm willing to respond, I have the same error, but it isn't on "init".

Win7 x64
npm 6.7.0
electron-forge 5.2.4
electron v4.0.4
npm 6.7.0

The init has no error on start

C:\electron-forge>electron-forge init test
√ Checking your system
√ Initializing Project Directory
√ Initializing Git Repository
√ Copying Starter Files
√ Initializing NPM Module
√ Installing NPM Dependencies

C:\electron-forge>cd test

C:\electron-forge\test>npm start

> [email protected] start C:\electron-forge\test
> electron-forge start

√ Checking your system
√ Locating Application
√ Preparing native dependencies
√ Launching Application

I copy over my fav project, just the src folder only. Needing modules like jquery and highcharts.

C:\electron-forge\test>npm install jquery highcharts
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: The major version is no longer supported. Please update to 4.x or newer
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Deprecated, use jstransformer
npm WARN deprecated [email protected]: Please update to at least constantinople 3.1.1
npm WARN deprecated [email protected]: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for
 any operations you were using wrench for. Thanks for all the usage over the years.
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN rm not removing C:\electron-forge\test\node_modules\.bin\uglifyjs.cmd as it wasn't installed by C:\electron-forge\test\node_modules
\uglify-js
npm WARN rm not removing C:\electron-forge\test\node_modules\.bin\uglifyjs as it wasn't installed by C:\electron-forge\test\node_modules\ugl
ify-js
npm WARN rm not removing C:\electron-forge\test\node_modules\.bin\semver.cmd as it wasn't installed by C:\electron-forge\test\node_modules\s
emver
npm WARN rm not removing C:\electron-forge\test\node_modules\.bin\semver as it wasn't installed by C:\electron-forge\test\node_modules\semve
r
npm WARN rm not removing C:\electron-forge\test\node_modules\.bin\gonzales.cmd as it wasn't installed by C:\electron-forge\test\node_modules
\gonzales-pe
npm WARN rm not removing C:\electron-forge\test\node_modules\.bin\gonzales as it wasn't installed by C:\electron-forge\test\node_modules\gon
zales-pe
npm WARN rm not removing C:\electron-forge\test\node_modules\.bin\electron.cmd as it wasn't installed by C:\electron-forge\test\node_modules
\electron
npm WARN rm not removing C:\electron-forge\test\node_modules\.bin\electron as it wasn't installed by C:\electron-forge\test\node_modules\ele
ctron
npm WARN rm not removing C:\electron-forge\test\node_modules\.bin\browserslist.cmd as it wasn't installed by C:\electron-forge\test\node_mod
ules\browserslist
npm WARN rm not removing C:\electron-forge\test\node_modules\.bin\browserslist as it wasn't installed by C:\electron-forge\test\node_modules
\browserslist

> [email protected] postinstall C:\electron-forge\test\node_modules\spawn-sync
> node postinstall


> [email protected] postinstall C:\electron-forge\test\node_modules\electron-prebuilt-compile\node_modules\electron
> node install.js

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\electron-installer-debian):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin,linux","arch":"
any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\appdmg):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"wi
n32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\electron-installer-redhat):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin,linux","arch":"
any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\electron-installer-flatpak):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin,linux","arch":
"any"} (current: {"os":"win32","arch":"x64"})

+ [email protected]
+ [email protected]
added 70 packages from 85 contributors, removed 63 packages, updated 937 packages and audited 9599 packages in 237.338s
found 18 vulnerabilities (4 low, 7 moderate, 7 high)
  run `npm audit fix` to fix them, or `npm audit` for details

C:\electron-forge\test>npm start

> [email protected] start C:\electron-forge\test
> electron-forge start

√ Checking your system
√ Locating Application
√ Preparing native dependencies
√ Launching Application

And now I have this error in the debug window:

Uncaught Error: Cannot find module 'electron-compile/lib/initialize-renderer'
    at Module._resolveFilename (internal/modules/cjs/loader.js:584)
    at Function.Module._resolveFilename (C:\electron-forge\test\node_modules\electron-prebuilt-compile\node_modules\electron\dist\resources\electron.asar\common\reset-search-paths.js:43)
    at Function.Module._load (internal/modules/cjs/loader.js:510)
    at Module.require (internal/modules/cjs/loader.js:640)
    at require (internal/modules/cjs/helpers.js:20)
    at __magic__file__to__help__electron__compile.js:1
internal/modules/cjs/loader.js:586

When moving to a different older dev machine, such as I did in this case, I ran the usual updates for the init.
npm install -g electron, npm install -g electron-forge and npm install -g npm

Then I copy my usual src folder to new project init to ensure the latest package.json.
This time around the above error occurred.

This error doesn't exist on my Windows 10 laptop with this same update and init and src copy procedure as of a few weeks ago, so im kinda miffed.

@malept
Copy link
Member

malept commented Feb 4, 2019

npm install -g electron

Definitely don't do that. That doesn't do anything for an Electron app project.

Is electron-compile in your dependencies section of package.json?

@Stylesoftware
Copy link

Hi Malept,
Hole in one... And thank you.,
Why isn't it installed on forge init ??

@malept
Copy link
Member

malept commented Feb 4, 2019

Why isn't it installed on forge init ??

It is installed on init. I suspect it might have been accidentally deleted somewhere around

I copy over my fav project

@Stylesoftware
Copy link

Stylesoftware commented Feb 5, 2019 via email

@malept
Copy link
Member

malept commented Feb 5, 2019

If you can provide a detailed (but minimal) set of reproducible instructions to get to the state where you have a Forge v5 project without electron-compile not in dependencies, that will make it significantly easier to determine if there's a bug, and where it might be.

@Stylesoftware
Copy link

Got the error with no file changes:

electron-forge init test
cd test
npm start // no error
npm install jquery
npm start // shows error

electron-forge init test2
cd test2
npm start // no error
yarn add jquery
npm start // no error
npm install jquery
npm start // shows error

@malept
Copy link
Member

malept commented Feb 5, 2019

What version of NPM is this?

@malept
Copy link
Member

malept commented Feb 5, 2019

I cannot reproduce this on Linux (Debian Stretch):

$ node --version
v10.2.1
$ npm --version
6.7.0
$ $(npm bin)/electron-forge --version
5.2.4

@Stylesoftware
Copy link

No probs, easy enough to fix, might just be this system setup.

@ghost
Copy link

ghost commented Mar 3, 2019

I used electron forge about 2 weeks ago and did not have as much trouble as I am getting now. This issue seems to be related to me doing an import with a relative path and electron forge chokes on resolving it.

I followed the instructions from the web site to install and run electron. Love the page of warning and errors. Last week I had 4 which I dealt but this speghetti...

ray@gamora:~/broke-stuff$ npm install -g electron-forge
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
npm WARN deprecated [email protected]: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years.
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN rm not removing /home/ray/.nvm/versions/node/v11.10.0/bin/electron-forge-vscode-nix as it wasn't installed by /home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge
npm WARN rm not removing /home/ray/.nvm/versions/node/v11.10.0/bin/electron-forge as it wasn't installed by /home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge
npm WARN rm not removing /home/ray/.nvm/versions/node/v11.10.0/bin/forge as it wasn't installed by /home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge
npm WARN rm not removing /home/ray/.nvm/versions/node/v11.10.0/bin/electron-forge-vscode-win as it wasn't installed by /home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge
/home/ray/.nvm/versions/node/v11.10.0/bin/electron-forge-vscode-win -> /home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge/script/vscode.cmd
/home/ray/.nvm/versions/node/v11.10.0/bin/electron-forge -> /home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge/dist/electron-forge.js
/home/ray/.nvm/versions/node/v11.10.0/bin/electron-forge-vscode-nix -> /home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge/script/vscode.sh
/home/ray/.nvm/versions/node/v11.10.0/bin/forge -> /home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge/dist/electron-forge.js

> [email protected] install /home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge/node_modules/fs-xattr
> node-gyp rebuild

make: Entering directory '/home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge/node_modules/fs-xattr/build'
  CXX(target) Release/obj.target/xattr/src/async.o
In file included from ../src/async.cc:2:
../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
../src/async.cc: In member function ‘virtual void XattrWorker::HandleErrorCallback()’:
../src/async.cc:35:27: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
     callback->Call(1, argv);
                           ^
In file included from ../src/async.cc:2:
../../nan/nan.h:1674:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^~~~
../src/async.cc: In constructor ‘SetWorker::SetWorker(v8::Local<v8::Value>, v8::Local<v8::Value>, v8::Local<v8::Value>, Nan::Callback*)’:
../src/async.cc:52:55: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
     v8::Local<v8::Object> bufferObj = value->ToObject();
                                                       ^
In file included from /home/ray/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../src/async.cc:1:
/home/ray/.node-gyp/11.10.0/include/node/v8.h:10254:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^~~~~
../src/async.cc: In member function ‘virtual void GetWorker::HandleOKCallback()’:
../src/async.cc:129:27: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
     callback->Call(2, argv);
                           ^
In file included from ../src/async.cc:2:
../../nan/nan.h:1674:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^~~~
../src/async.cc: In member function ‘virtual void ListWorker::HandleOKCallback()’:
../src/async.cc:186:27: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]
     callback->Call(2, argv);
                           ^
In file included from ../src/async.cc:2:
../../nan/nan.h:1674:3: note: declared here
   Call(int argc, v8::Local<v8::Value> argv[]) const {
   ^~~~
In file included from /home/ray/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../src/async.cc:1:
/home/ray/.node-gyp/11.10.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/ray/.node-gyp/11.10.0/include/node/node_object_wrap.h:85:78:   required from here
/home/ray/.node-gyp/11.10.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ray/.node-gyp/11.10.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:66:61:   required from here
/home/ray/.node-gyp/11.10.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  CXX(target) Release/obj.target/xattr/src/error.o
In file included from ../src/error.cc:3:
../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
../src/error.cc: In function ‘v8::Local<v8::Value> MakeXattrError(int)’:
../src/error.cc:109:79: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
  v8::Local<v8::Object> err = Nan::Error(errorDescriptionForGet(e))->ToObject();
                                                                              ^

In file included from /home/ray/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../src/error.cc:2:
/home/ray/.node-gyp/11.10.0/include/node/v8.h:10254:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^~~~~
/home/ray/.node-gyp/11.10.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/ray/.node-gyp/11.10.0/include/node/node_object_wrap.h:85:78:   required from here
/home/ray/.node-gyp/11.10.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ray/.node-gyp/11.10.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:66:61:   required from here
/home/ray/.node-gyp/11.10.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  CXX(target) Release/obj.target/xattr/src/sync.o
In file included from ../src/sync.cc:2:
../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
../src/sync.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE xattr_set_sync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/sync.cc:58:55: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
   v8::Local<v8::Object> bufferObj = info[2]->ToObject();
                                                       ^
In file included from /home/ray/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../src/sync.cc:1:
/home/ray/.node-gyp/11.10.0/include/node/v8.h:10254:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^~~~~
/home/ray/.node-gyp/11.10.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/ray/.node-gyp/11.10.0/include/node/node_object_wrap.h:85:78:   required from here
/home/ray/.node-gyp/11.10.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ray/.node-gyp/11.10.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:66:61:   required from here
/home/ray/.node-gyp/11.10.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  CXX(target) Release/obj.target/xattr/src/util.o
In file included from ../src/util.cc:2:
../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from /home/ray/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../src/util.cc:1:
/home/ray/.node-gyp/11.10.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/ray/.node-gyp/11.10.0/include/node/node_object_wrap.h:85:78:   required from here
/home/ray/.node-gyp/11.10.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ray/.node-gyp/11.10.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:66:61:   required from here
/home/ray/.node-gyp/11.10.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  CXX(target) Release/obj.target/xattr/src/xattr.o
In file included from ../src/xattr.cc:2:
../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
                                                              ^
In file included from ../src/xattr.cc:1:
../src/xattr.cc: At global scope:
/home/ray/.node-gyp/11.10.0/include/node/node.h:495:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/home/ray/.node-gyp/11.10.0/include/node/node.h:529:3: note: in expansion of macro ‘NODE_MODULE_X’
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/xattr.cc:27:1: note: in expansion of macro ‘NODE_MODULE’
 NODE_MODULE(xattr, Initialize)
 ^~~~~~~~~~~
In file included from /home/ray/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../src/xattr.cc:1:
/home/ray/.node-gyp/11.10.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/ray/.node-gyp/11.10.0/include/node/node_object_wrap.h:85:78:   required from here
/home/ray/.node-gyp/11.10.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ray/.node-gyp/11.10.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:66:61:   required from here
/home/ray/.node-gyp/11.10.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
  SOLINK_MODULE(target) Release/obj.target/xattr.node
  COPY Release/xattr.node
make: Leaving directory '/home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge/node_modules/fs-xattr/build'

> [email protected] install /home/ray/.nvm/versions/node/v11.10.0/lib/node_modules/electron-forge
> node tabtab-install.js

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/electron-forge/node_modules/macos-alias):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/electron-forge/node_modules/appdmg):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ [email protected]
added 34 packages from 33 contributors and updated 9 packages in 54.907s
ray@gamora:~/broke-stuff$ electron-forge init my-new-project
✔ Checking your system
✔ Initializing Project Directory
✔ Initializing Git Repository
✔ Copying Starter Files
✔ Initializing NPM Module
✔ Installing NPM Dependencies
ray@gamora:~/broke-stuff$ cd my-new-project
ray@gamora:~/broke-stuff/my-new-project$ electron-forge start
✔ Checking your system
✔ Locating Application
✔ Preparing native dependencies
✔ Launching Application
ray@gamora:~/broke-stuff/my-new-project$ cat package.json
{
  "name": "my-new-project",
  "productName": "my-new-project",
  "version": "1.0.0",
  "description": "My Electron application description",
  "main": "src/index.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "lint": "eslint src --color"
  },
  "keywords": [],
  "author": "ray",
  "license": "MIT",
  "config": {
    "forge": {
      "make_targets": {
        "win32": [
          "squirrel"
        ],
        "darwin": [
          "zip"
        ],
        "linux": [
          "deb",
          "rpm"
        ]
      },
      "electronPackagerConfig": {
        "packageManager": "npm"
      },
      "electronWinstallerConfig": {
        "name": "my_new_project"
      },
      "electronInstallerDebian": {},
      "electronInstallerRedhat": {},
      "github_repository": {
        "owner": "",
        "name": ""
      },
      "windowsStoreConfig": {
        "packageName": "",
        "name": "mynewproject"
      }
    }
  },
  "dependencies": {
    "electron-compile": "^6.4.4",
    "electron-squirrel-startup": "^1.0.0"
  },
  "devDependencies": {
    "babel-plugin-transform-async-to-generator": "^6.24.1",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "electron-forge": "^5.2.4",
    "electron-prebuilt-compile": "4.0.0",
    "eslint": "^3.19.0",
    "eslint-config-airbnb": "^15.1.0",
    "eslint-plugin-import": "^2.16.0",
    "eslint-plugin-jsx-a11y": "^5.1.1",
    "eslint-plugin-react": "^7.12.4"
  }
}
ray@gamora:~/broke-stuff/my-new-project$ npm start

> [email protected] start /home/ray/broke-stuff/my-new-project
> electron-forge start

✔ Checking your system
✔ Locating Application
✔ Preparing native dependencies
✔ Launching Application
ray@gamora:~/broke-stuff/my-new-project$ 

Now to reproduce the error.. alter src/index.html like so

<!-- /src/index.html -->
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <!-- following line to prevent anoying favicon error -->
    <link rel="icon" href="data:,">
    <!-- following line to reproduce error -->
    <script type="module" src="./js/test.js"></script>
    <title></title>
  </head>
  <body>
    Well hey there!!!
  </body>
</html>

Then make folder named "js" and in that put this script:

// src/js/test.js

import { testString } from '../utils/test-string.js';

const hearMeRoar = testString("Rawww!")
console.log(hearMeRoar)

Then we create the utils script test.js is importing. Make a folder "utils" and put this file in it:

// src/utils/test-string.js

// EXPORTS/FUNCTIONS
/**
 * @function testString
 * @param {String} fragment what you want to say
 * @return {String} what's been said plus your fragment
 */
export const testString = (fragment) => `An injured lion still wants to roar. -Randy Pausch ${fragment}`

When I save all and run the example in a server ( Using http-server npm module "http-server ./ -p 8080")
screenshot-1

HOWEVER when I continue with the Electron Forge documentation and run "npm start" I get:
screenshot-2

And don't even get me started with the make errors I'm getting. About a week ago I ran some tests with electron forge to see if it was good for my project. It worked well enough maybe 4 errors to fix. Better than the rest I found. Now today. Can't reproduce that success but I can reproduce this Error.

@ghost
Copy link

ghost commented Mar 3, 2019

I can get everything working if I change the extensions on the file to .mjs and use the npx install instructions for electron-forge.

Using the .js causes the problem. I was going to use .js to get the intellisense from vscode. A sore spot to be sure. Can't say typescript is a superset of javascript if the tool doesn't extend the core js.

I'm fine with electron-forge's behavior in this point.

@tokensalad
Copy link

I am still getting this, @clintmulligan would you mind detailing exactly what you did as I am losing my mind on this:
Node v10.13.0
npm v6.4.1
electron-forge 5.2.4

@ghost
Copy link

ghost commented Jun 12, 2019 via email

@tokensalad
Copy link

I really appreciate you getting back to me so quickly. I did try that but with no success (I'm pretty sure that the problem is as you describe, as the event called via the import fails as 'undefined'). Again, rally appreciate you taking the time to respond.

@malept
Copy link
Member

malept commented Jun 12, 2019

At this point in time, I'd suggest using Electron Forge v6 + the webpack template, instead of the electron-compile ecosystem.

@tokensalad

This comment has been minimized.

dsanders11 pushed a commit that referenced this issue Jan 14, 2023
* feat: autobisect gui
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

4 participants