electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.49k stars 516 forks source link

init fails due to yarn errors #408

Closed stanbar closed 6 years ago

stanbar commented 6 years ago

Hello. I'm facing with error when executing sudo npm install -g electron-forge

npm WARN deprecated wrench@1.5.9: 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 graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/usr/local/bin/electron-forge-vscode-win -> /usr/local/lib/node_modules/electron-forge/script/vscode.cmd
/usr/local/bin/electron-forge -> /usr/local/lib/node_modules/electron-forge/dist/electron-forge.js
/usr/local/bin/forge -> /usr/local/lib/node_modules/electron-forge/dist/electron-forge.js
/usr/local/bin/electron-forge-vscode-nix -> /usr/local/lib/node_modules/electron-forge/script/vscode.sh

> macos-alias@0.2.11 install /usr/local/lib/node_modules/electron-forge/node_modules/macos-alias
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/electron-forge/node_modules/macos-alias/build'
gyp ERR! System Darwin 17.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/electron-forge/node_modules/macos-alias
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

> fs-xattr@0.1.17 install /usr/local/lib/node_modules/electron-forge/node_modules/fs-xattr
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/electron-forge/node_modules/fs-xattr/build'
gyp ERR! System Darwin 17.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/electron-forge/node_modules/fs-xattr
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

> electron-forge@4.2.0 install /usr/local/lib/node_modules/electron-forge
> node tabtab-install.js

User shell sh not supported, skipping completion install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: macos-alias@0.2.11 (node_modules/electron-forge/node_modules/macos-alias):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: macos-alias@0.2.11 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs-xattr@0.1.17 (node_modules/electron-forge/node_modules/fs-xattr):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs-xattr@0.1.17 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ electron-forge@4.2.0
added 5 packages and updated 1 package in 17.365s

ignoring that and executing electron-forge import . give me another error:

✔ Checking your system
? WARNING: We will now attempt to import: "/Users/admin1/GoogleDrive/JSProjects/
shoppinglist".  This will involve modifying some files, are you sure you want to
 continue? Yes
✔ Initializing Git Repository
? Do you want us to change the "main" attribute of your package.json?  If you ar
e currently using babel and pointing to a "build" directory say yes. No
? Do you want us to remove the "electron-packager" dependency in package.json? E
lectron Forge already uses this module as a transitive dependency. Yes
? Do you want us to update the "start" script to instead call the electron-forge
 task "electron-forge start" Yes
? Do you want us to update the "package" script to instead call the electron-for
ge task "electron-forge package" Yes
? Do you want us to update the "make" script to instead call the electron-forge 
task "electron-forge make" Yes
✔ Writing modified package.json file
✖ Pruning deleted modules

An unhandled error has occurred inside Forge:
Exited with status 1
Error: Exited with status 1
    at closeArgsToError (/usr/local/lib/node_modules/electron-forge/node_modules/cross-spawn-promise/lib/index.js:20:16)
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/electron-forge/node_modules/cross-spawn-promise/lib/index.js:76:19)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
malept commented 6 years ago

Both of these seem like problems with npm rather than Forge.

In the import case, can you re-run with the environment variable DEBUG=electron-forge:* set?

stanbar commented 6 years ago

sure

✔ Checking your system
? WARNING: We will now attempt to import: "/Users/admin1/GoogleDrive/JSProjects/
shoppinglist".  This will involve modifying some files, are you sure you want to
 continue? Yes
✔ Initializing Git Repository
? Do you want us to change the "main" attribute of your package.json?  If you ar
e currently using babel and pointing to a "build" directory say yes. No
✔ Writing modified package.json file
✖ Installing dependencies

An unhandled error has occurred inside Forge:
Failed to install modules: ["electron-compile","electron-squirrel-startup"]

With output: Exited with status 1
Error: Failed to install modules: ["electron-compile","electron-squirrel-startup"]

With output: Exited with status 1
    at /usr/local/lib/node_modules/electron-forge/dist/util/install-dependencies.js:55:13
    at Generator.throw (<anonymous>)
    at Generator.tryCatcher (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/util.js:16:23)
    at PromiseSpawn._promiseRejected (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/generators.js:107:10)
    at Promise._settlePromise (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:576:26)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
malept commented 6 years ago

That seems like it failed in a different place. Also, I'm not seeing any debug output. Please run export DEBUG='electron-forge:*' and then re-run the import.

stanbar commented 6 years ago

Yeah, sorry.

WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Checking your system +0ms
  electron-forge:lifecycle Process Succeeded: Checking your system +876ms
  electron-forge:runtime-config setting key: verbose to value: false +0ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:import Attempting to import project in: /Users/admin1/GoogleDrive/JSProjects/shoppinglist +0ms
? WARNING: We will now attempt to import: "/Users/admin1/GoogleDrive/JSProjects/
shoppinglist".  This will involve modifying some files, are you sure you want to
 continue? Yes
  electron-forge:lifecycle Process Started: Initializing Git Repository +0ms
  electron-forge:init:git .git directory already exists, skipping git initialization +0ms
  electron-forge:lifecycle Process Succeeded: Initializing Git Repository +2ms
? Do you want us to change the "main" attribute of your package.json?  If you ar
e currently using babel and pointing to a "build" directory say yes. No
  electron-forge:import reading current scripts object: { start: 'electron-forge start',
  'package-mac': 'electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds',
  'package-win': 'electron-packager . electron-tutorial-app --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName="Shopping List"',
  'package-linux': 'electron-packager . electron-tutorial-app --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/icon.png --prune=true --out=release-builds',
  package: 'electron-forge package',
  make: 'electron-forge make' } +16s
  electron-forge:import forgified scripts object: { start: 'electron-forge start',
  'package-mac': 'electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds',
  'package-win': 'electron-packager . electron-tutorial-app --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName="Shopping List"',
  'package-linux': 'electron-packager . electron-tutorial-app --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/icon.png --prune=true --out=release-builds',
  package: 'electron-forge package',
  make: 'electron-forge make' } +3ms
  electron-forge:lifecycle Process Started: Writing modified package.json file +3s
  electron-forge:lifecycle Process Succeeded: Writing modified package.json file +4ms
  electron-forge:lifecycle Process Started: Installing dependencies +0ms
  electron-forge:import deleting old dependencies forcefully +5ms
  electron-forge:import installing dependencies +2ms
  electron-forge:dependency-installer installing ["electron-compile","electron-squirrel-startup"] in: /Users/admin1/GoogleDrive/JSProjects/shoppinglist dev=false,exact=false,withYarn=true +0ms
  electron-forge:dependency-installer executing ["add","electron-compile","electron-squirrel-startup"] in: /Users/admin1/GoogleDrive/JSProjects/shoppinglist +1ms
  electron-forge:runtime-config fetching key verbose +0ms
  electron-forge:lifecycle Process Failed: Installing dependencies +1s

An unhandled error has occurred inside Forge:
Failed to install modules: ["electron-compile","electron-squirrel-startup"]

With output: Exited with status 1
Error: Failed to install modules: ["electron-compile","electron-squirrel-startup"]

With output: Exited with status 1
    at /usr/local/lib/node_modules/electron-forge/dist/util/install-dependencies.js:55:13
    at Generator.throw (<anonymous>)
    at Generator.tryCatcher (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/util.js:16:23)
    at PromiseSpawn._promiseRejected (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/generators.js:107:10)
    at Promise._settlePromise (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:576:26)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
ezweave commented 6 years ago

Any update on this? I have the same issue when running electron-forge init project-name --template=react-typescript.

I get the following output:

WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Checking your system +0ms
  electron-forge:lifecycle Process Succeeded: Checking your system +652ms
  electron-forge:runtime-config setting key: verbose to value: false +0ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:init Initializing in: /Users/e211837/code/mediauploader +0ms
  electron-forge:lifecycle Process Started: Initializing Project Directory +0ms
  electron-forge:init:directory creating directory: /Users/e211837/code/mediauploader +0ms
  electron-forge:lifecycle Process Succeeded: Initializing Project Directory +12ms
  electron-forge:lifecycle Process Started: Initializing Git Repository +1ms
  electron-forge:init:git executing "git init" in directory: /Users/e211837/code/mediauploader +0ms
  electron-forge:lifecycle Process Succeeded: Initializing Git Repository +20ms
  electron-forge:lifecycle Process Started: Copying Starter Files +1ms
  electron-forge:init:starter-files creating directory: /Users/e211837/code/mediauploader/src +0ms
  electron-forge:init:starter-files copying "/usr/local/lib/node_modules/electron-forge/tmpl/_gitignore" --> "/Users/e211837/code/mediauploader/.gitignore" +1ms
  electron-forge:init:starter-files copying "/usr/local/lib/node_modules/electron-forge/tmpl/_compilerc" --> "/Users/e211837/code/mediauploader/.compilerc" +2ms
  electron-forge:init:starter-files copying "/usr/local/lib/node_modules/electron-forge/tmpl/index.js" --> "/Users/e211837/code/mediauploader/src/index.js" +1ms
  electron-forge:init:starter-files copying "/usr/local/lib/node_modules/electron-forge/tmpl/index.html" --> "/Users/e211837/code/mediauploader/src/index.html" +1ms
  electron-forge:lifecycle Process Succeeded: Copying Starter Files +6ms
  electron-forge:lifecycle Process Started: Initializing NPM Module +1ms
  electron-forge:init:npm writing package.json to: /Users/e211837/code/mediauploader +0ms
  electron-forge:lifecycle Process Succeeded: Initializing NPM Module +346ms
  electron-forge:lifecycle Process Started: Installing NPM Dependencies +0ms
  electron-forge:init:npm installing dependencies +3ms
  electron-forge:dependency-installer installing ["electron-compile","electron-squirrel-startup"] in: /Users/e211837/code/mediauploader dev=false,exact=false,withYarn=true +0ms
  electron-forge:dependency-installer executing ["add","electron-compile","electron-squirrel-startup"] in: /Users/e211837/code/mediauploader +0ms
  electron-forge:runtime-config fetching key verbose +0ms
  electron-forge:lifecycle Process Failed: Installing NPM Dependencies +2s

An unhandled error has occurred inside Forge:
Failed to install modules: ["electron-compile","electron-squirrel-startup"]

With output: Exited with status 1
Error: Failed to install modules: ["electron-compile","electron-squirrel-startup"]

With output: Exited with status 1
    at /usr/local/lib/node_modules/electron-forge/dist/util/install-dependencies.js:55:13
    at Generator.throw (<anonymous>)
    at Generator.tryCatcher (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/util.js:16:23)
    at PromiseSpawn._promiseRejected (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/generators.js:107:10)
    at Promise._settlePromise (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:576:26)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:756:18)
    at tryOnImmediate (timers.js:717:5)
    at processImmediate [as _immediateCallback] (timers.js:697:5)

NPM version is: 5.6.0

Electron is: 1.84

Electron-forge version is: 5.1.1

malept commented 6 years ago

@ezweave I guess you need to run electron-forge --verbose init project-name --template=react-typescript in order to get the output from yarn (which is what's causing the error in both cases). Could you paste the output from that command? (and the Yarn version)

ezweave commented 6 years ago

@malept Yeah, I realized it is actually a yarn issue. I know there are some problems in getting yarn to authenticate with a repo (our nexus host in this case).

Adding the output results in this error:

error An unexpected error occurred: "http://nexus-host-name:8081/content/groups/npm-all/btoa/-/btoa-1.1.2.tgz: Request failed \"401 Unauthorized\"".

Since others may encounter this.. I'll see if I can fix the auth issue in yarn and post an update.

malept commented 6 years ago

Since the errors are due to yarn instead of Electron Forge, I'm going to close this issue.

annymosse commented 6 years ago
✔ Initializing NPM Module
✖ Installing NPM Dependencies

An unhandled error has occurred inside Forge:
Failed to install modules: ["electron-squirrel-startup"]

With output: Exited with status 1
Error: Failed to install modules: ["electron-squirrel-startup"]

With output: Exited with status 1
    at /home/XXX/.nvm/versions/node/v8.12.0/lib/node_modules/@electron-forge/cli/node_modules/@electron-forge/core/src/util/install-dependencies.ts:34:11
    at Generator.throw (<anonymous>)
    at step (/home/XXX/.nvm/versions/node/v8.12.0/lib/node_modules/@electron-forge/cli/node_modules/@electron-forge/core/dist/util/install-dependencies.js:16:221)
    at _throw (/home/XXX/.nvm/versions/node/v8.12.0/lib/node_modules/@electron-forge/cli/node_modules/@electron-forge/core/dist/util/install-dependencies.js:16:455)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)