cannot find module in electron prebuilt 1.x but in 0.x (0.2 and 0.3 - module

I have a small code, that run well in electron (using prebuild 0.3.5, and 0.25).
I upgrade to electron prebuild 1.1.0 and 1.2.0
I got error
Uncaught Exception:
Error: Cannot find module 'app'
at Module._resolveFilename (module.js:438:15)
at Function.Module._resolveFilename (/home/mervo/electron/midas-tron/node_modules/electron-prebuilt/dist/resources/electron.asar/common/reset-search-paths.js:47:12)
at Function.Module._load (module.js:386:25)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at Object. (/ho
I think there is a change in structure in 1.x, that I dont know, can help?

The correct way to require the app module in Electron v1.0.0+ is:
const { app } = require('electron');
The same applies to any other built-in Electron module you could previously require directly.

Related

Unable to run npx for create-nuxt-app without it failing due to is-promise

I am attempting to create a nuxt app in the command line, going to build a Vue web app running off this and Vuetify. I am not sure what I am doing wrong but I run the exact scaffolding command that the docs tell me to run and it errors out everytime with this message.
PS C:\users\gman\documents\github> npx create-nuxt-app myappname
create-nuxt-app v2.15.0
✨ Generating Nuxt.js project in myappname
Trace: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\GMan\AppData\Roaming\npm-cache\_npx\23248\node_modules\create-nuxt-app\node_modules\is-promise\index.js
require() of ES modules is not supported.
require() of C:\Users\GMan\AppData\Roaming\npm-cache\_npx\23248\node_modules\create-nuxt-app\node_modules\is-promise\index.js from C:\Users\GMan\AppData\Roaming\npm-cache\_npx\23248\node_modules\create-nuxt-app\node_modules\run-async\index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename C:\Users\GMan\AppData\Roaming\npm-cache\_npx\23248\node_modules\create-nuxt-app\node_modules\is-promise\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\GMan\AppData\Roaming\npm-cache\_npx\23248\node_modules\create-nuxt-app\node_modules\is-promise\package.json.
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1172:13)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\GMan\AppData\Roaming\npm-cache\_npx\23248\node_modules\create-nuxt-app\node_modules\run-async\index.js:3:17)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14) {
code: 'ERR_REQUIRE_ESM'
}
at C:\Users\GMan\AppData\Roaming\npm-cache\_npx\23248\node_modules\create-nuxt-app\cli.js:46:17
Has anyone else run into this, google searching is turning up nothing, figure I would check here to see if anyone know what might be up.
Thanks!
I determined that is-promise pushed a commit 2 hours ago that broke.
They are fixing it sounds like.

SyntaxError: Cannot use import statement outside a module Angular 5

We are developing an application in Angular5. Now we are integrating SSR with our project. We installed express engine and platform server, also followed every steps needed for SSR.
While we building the application it was successful. When we run the command npm run serve, it will call node server.js. At this time it is throwing the error as below:
node_modules#ng-bootstrap\ng-bootstrap\modal\modal-stack.js:1 import
{ DOCUMENT } from '#angular/common'; ^^^^^^
SyntaxError: Cannot use import statement outside a module
at Module._compile (internal/modules/cjs/loader.js:892:18)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
It is ng-bootstrap module we use. Anyone can give clue why this error?
Thanks!

Node Modules not generated

I have created a new node (MERN) app on my mac osx. Im learning (from rails).
I don't know why, but whilst I do have a package.json file, I cannot generate a node_modules folder. I have tried all of the suggested answers in this post.
When I go to the terminal and test:
ls node_modules
I get a long list of all the modules listed in my package.json (but no node modules folder in my app file in atom).
That list includes all of my babel modules.
When I try to start the app, I get an error that arises out of my using import statements instead of require (which I should be able to do if babel were working).
node server.js
/Users/mr_may/server.js:1
(function (exports, require, module, __filename, __dirname) { import express from 'express';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:390:7)
at startup (bootstrap_node.js:150:9)
Does anyone know how to configure a new node app so that it generates the node modules folder? Apart from the post above, I can't find any suggestions on how to work through this problem. The answers in the post linked above haven't worked.
hi you may want to make sure you are in the directory of your folder
e.g.
cd Desktop/My_Project
The safest way is the then run npm init get all the required things fill out and run npm install --save babel-core at this point you should be able to see the node_modules folder found in "Desktop/My_Project/node_modules"
Try this out and hope this helps :D

npm module error on 'inflight' when attempting to build semantic UI

I'm attempting to use the React Starter Kit with SemanticUI on Windows. I can install and build RSK, but when I run npm install semantic-ui and go through the set up, I always hit the same module error and I am unsure how to solve it.
gulp build
module.js:341
throw err;
^
Error: Cannot find module 'inflight'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\Users\Alex\AppData\Roaming\npm\node_modules\gulp\node_modules\glob\glob.js:57:16)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
I have tried nuking the directory and reinstalling multiple times, but I am unable to get this to work. What is causing the issue?
You may be hitting the same issues people are having on npm 2701. The issue appears to be related to version updates between installing NPM modules (from a quick read over the later parts of the report). Suggestions include running:
npm set registry https://registry.npmjs.org/
And alternatively, removing all currently installed node modules including globally installed modules (in /usr/node-modules/ or C:\Program Files\nodejs\node_modules for example). The user deleted them manually (i.e. not using npm).
I also faced same issue while running react app. I simply installed it
npm install inflight
Although after it there prompt another error msg which was failed to find moudule 'source-list-map' then I installed it as well
npm install source-list-map
I hope it will help you

How to compile dojo themes in windows using nodejs?

I download the dojo source with the themes and compiler and i tried to compile it using node.js
and followed the instruction below, but was unable to compile it in pc environment?
Can some help?
http://davidwalsh.name/dijit-theme
http://nodejs.org/#
C:\Downloads\dojo-release-1.7.3-src\dojo-release-1.7.3-src\dijit\themes\claro>node compile.js
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
at Function.Module._compile.Object.defineProperty.get (module.js:386:11)
at Object.<anonymous> (C:\Downloads\dojo-release-1.7.3-src\dojo-release-1.7.3-src\util\less\ind
ex.js:5:8)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (C:\Downloads\dojo-release-1.7.3-src\dojo-release-1.7.3-src\dijit\themes\
claro\compile.js:8:9)
at Module._compile (module.js:449:26)
It looks like you're using an outdated version of LESS with a newer version of node.
dojo-release-1.7.3-src comes bundled with LESS 1.1.3, released early 2011.
Replace util/less with a more recent version of LESS.
Alternatively, all compile.js is doing is running the LESS parser against all of the LESS files in the theme directory. You could install the LESS command line tools (npm install -g less) and invoke lessc on the LESS files manually.