forge: init failed to install via NPM 5.x on Windows (EPERM)

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue: Trying to create my first electron project (as given in the React + TypeScript sample) using a newly installed electon-forge failed to install babel modules. During a second attempt it failed to install react modules. During a third attempt it failed with the babel modules again.

Console output when you run electron-forge with the environment variable DEBUG=electron-forge:*. (Instructions on how to do so here). Please include the stack trace if one exists.

D:\Docs\Scripts\JS>electron-forge init test_1 --template=react-typescript
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 +1s
  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: D:\Docs\Scripts\JS\test_1 +0ms
  electron-forge:lifecycle Process Started: Initializing Project Directory +0ms
  electron-forge:init:directory creating directory: D:\Docs\Scripts\JS\test_1 +0ms
  electron-forge:init:directory found 7 files in the directory.  warning the user +5ms
  electron-forge:lifecycle Process Stopped: Initializing Project Directory +8ms
? WARNING: The specified path: "D:\Docs\Scripts\JS\test_1" is not empty, do you wish to continue? Yes
  electron-forge:lifecycle Process Succeeded: Initializing Project Directory +6s
  electron-forge:lifecycle Process Started: Initializing Git Repository +3ms
  electron-forge:init:git .git directory already exists, skipping git initialization +0ms
  electron-forge:lifecycle Process Succeeded: Initializing Git Repository +4ms
  electron-forge:lifecycle Process Started: Copying Starter Files +2ms
  electron-forge:init:starter-files creating directory: D:\Docs\Scripts\JS\test_1\src +0ms
  electron-forge:init:starter-files copying "D:\Apps\Roaming\npm\node_modules\electron-forge\tmpl\_gitignore" --> "D:\Docs\Scripts\JS\test_1\.gitignore" +2ms
  electron-forge:init:starter-files copying "D:\Apps\Roaming\npm\node_modules\electron-forge\tmpl\_compilerc" --> "D:\Docs\Scripts\JS\test_1\.compilerc" +14ms
  electron-forge:init:starter-files copying "D:\Apps\Roaming\npm\node_modules\electron-forge\tmpl\index.js" --> "D:\Docs\Scripts\JS\test_1\src\index.js" +5ms
  electron-forge:init:starter-files copying "D:\Apps\Roaming\npm\node_modules\electron-forge\tmpl\index.html" --> "D:\Docs\Scripts\JS\test_1\src\index.html" +4m
s
  electron-forge:lifecycle Process Succeeded: Copying Starter Files +33ms
  electron-forge:lifecycle Process Started: Initializing NPM Module +3ms
  electron-forge:init:npm writing package.json to: D:\Docs\Scripts\JS\test_1 +0ms
  electron-forge:lifecycle Process Succeeded: Initializing NPM Module +68ms
  electron-forge:lifecycle Process Started: Installing NPM Dependencies +1ms
  electron-forge:init:npm installing dependencies +6ms
  electron-forge:dependency-installer installing ["electron-compile","electron-squirrel-startup"] in: D:\Docs\Scripts\JS\test_1 dev=false,exact=false,withYarn=f
alse +0ms
  electron-forge:dependency-installer executing ["install","electron-compile","electron-squirrel-startup","--save"] in: D:\Docs\Scripts\JS\test_1 +4ms
  electron-forge:runtime-config fetching key verbose +0ms
  electron-forge:init:npm installing devDependencies +8s
  electron-forge:dependency-installer installing ["babel-preset-env","babel-preset-react","babel-plugin-transform-async-to-generator","electron-forge"] in: D:\D
ocs\Scripts\JS\test_1 dev=true,exact=false,withYarn=false +8s
  electron-forge:dependency-installer executing ["install","babel-preset-env","babel-preset-react","babel-plugin-transform-async-to-generator","electron-forge",
"--save-dev"] in: D:\Docs\Scripts\JS\test_1 +3ms
  electron-forge:runtime-config fetching key verbose +8s
  electron-forge:lifecycle Process Failed: Installing NPM Dependencies +44s

An unhandled error has occurred inside Forge:
Failed to install modules: ["babel-preset-env","babel-preset-react","babel-plugin-transform-async-to-generator","electron-forge"]

With output: Exited with status 4294963248
Error: Failed to install modules: ["babel-preset-env","babel-preset-react","babel-plugin-transform-async-to-generator","electron-forge"]

With output: Exited with status 4294963248
    at _callee$ (D:\Apps\Roaming\npm\node_modules\electron-forge\dist\util\install-dependencies.js:81:19)
    at tryCatch (D:\Apps\Roaming\npm\node_modules\electron-forge\node_modules\regenerator-runtime\runtime.js:65:40)
    at Generator.invoke [as _invoke] (D:\Apps\Roaming\npm\node_modules\electron-forge\node_modules\regenerator-runtime\runtime.js:299:22)
    at Generator.prototype.(anonymous function) [as throw] (D:\Apps\Roaming\npm\node_modules\electron-forge\node_modules\regenerator-runtime\runtime.js:117:21)
    at Generator.tryCatcher (D:\Apps\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\util.js:16:23)
    at PromiseSpawn._promiseRejected (D:\Apps\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\generators.js:107:10)
    at Promise._settlePromise (D:\Apps\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\promise.js:576:26)
    at Promise._settlePromise0 (D:\Apps\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (D:\Apps\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\promise.js:689:18)
    at Async._drainQueue (D:\Apps\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (D:\Apps\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (D:\Apps\Roaming\npm\node_modules\electron-forge\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:781:20)
    at tryOnImmediate (timers.js:743:5)
    at processImmediate [as _immediateCallback] (timers.js:714:5)

What command line arguments are you passing?

init test_1 --template=react-typescript

What does your config.forge data in package.json look like?

"forge": {
    "make_targets": {
	"win32": [
	    "squirrel"
	],
	"darwin": [
	    "zip"
	],
	"linux": [
	    "deb",
	    "rpm"
	]
    },
    "electronPackagerConfig": {
	"packageManager": "npm"
    },
    "electronWinstallerConfig": {
	"name": "test_1"
    },
    "electronInstallerDebian": {},
    "electronInstallerRedhat": {},
    "github_repository": {
	"owner": "",
	"name": ""
    },
    "windowsStoreConfig": {
	"packageName": "",
	"name": "test_1"
    }
}

Please provide either a failing minimal testcase (with a link to the code) or detailed steps to reproduce your problem. Using electron-forge init is a good starting point, if that is not the source of your problem. Run: electron-forge init test_1 --template=react-typescript

Environment Using latest versions of node (v8.2.1) and npm (5.5.1) in an up to date Windows 7 Pro.

N.B. npm install -g electron-forge had given serveral WARN deprecated warnings, and about skipping optional dependencies, but seemed to have installed OK, ending:

+ electron-forge@4.1.2
added 599 packages in 57.485s

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 25 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Same error as @mnemanja: Issue resolved with yarn.

The EPERM syscall scandir error appears to be https://github.com/npm/npm/issues/17747, which is not a Forge-specific error. We can’t do anything about that - the workarounds are to either use Yarn or an older version of NPM.