Oni: Error building Oni on OSX

Created on 25 Mar 2018  路  6Comments  路  Source: onivim/oni

Using:

  • OSX 10.12.6 (16G1212)
  • npm 5.6.0
  • yarn 1.5.1
  • node 9.4.0
  • nvm 0.33.8
  • gcc Apple LLVM version 9.0.0 (clang-900.0.39.2)
  • make 3.8.1

I get the following warning when running npm run build:

WARNING in ./node_modules/cross-spawn/index.js
Module not found: Error: Can't resolve 'spawn-sync' in '/Users/redacted/Documents/projects/oni/node_modules/cross-spawn'
 @ ./node_modules/cross-spawn/index.js 32:26-47
 @ ./node_modules/execa/index.js
 @ ./node_modules/shell-env/index.js
 @ ./browser/src/Plugins/Api/Process.ts
 @ ./browser/src/Plugins/PluginInstaller.ts
 @ ./browser/src/Plugins/PluginManager.ts
 @ ./browser/src/App.ts
 @ ./browser/src/index.tsx
 @ multi ./browser/src/index.tsx

And when running npm link:

An unhandled error occurred inside electron-rebuild
ENOENT: no such file or directory, open '/Users/redacted/Documents/projects/oni/node_modules/execa/node_modules/cross-spawn/package.json'

Error: ENOENT: no such file or directory, open '/Users/redacted/Documents/projects/oni/node_modules/execa/node_modules/cross-spawn/package.json'
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! [email protected] postinstall: `npm run install:plugins && electron-rebuild && opencollective postinstall`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/redacted/.npm/_logs/2018-03-25T07_42_51_375Z-debug.log

I've attached the npm debug log:
oni-link-debug.log

insider

Most helpful comment

I was able to get it to build by downgrading to node v8.10.0 (LTS) and npm 5.6.0 and using the workaround in https://github.com/onivim/oni/issues/1460

All 6 comments

I tried upgrading to node v9.9.0 and npm 5.8.0 and get this error on npm link:

error An unexpected error occurred: "/Users/redacted/Documents/projects/oni/node_modules/oniguruma: Command failed.
Exit code: 1
Command: sh
Arguments: -c node-gyp rebuild
Directory: /Users/redacted/Documents/projects/oni/node_modules/oniguruma
Output:
module.js:545
    throw err;
    ^

Error: Cannot find module '/Users/redacted/.nvm/versions/node/v9.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js'
    at Function.Module._resolveFilename (module.js:543:15)
    at Function.Module._load (module.js:470:25)
    at Function.Module.runMain (module.js:690:10)

I was able to get it to build by downgrading to node v8.10.0 (LTS) and npm 5.6.0 and using the workaround in https://github.com/onivim/oni/issues/1460

Running into this on Arch Linux + node v8.11.1.

Similarily was able to get it to build following this comment. But the same error will still appear if I try to develop locally while running: yarn start/npm run start

[1] WARNING in ./node_modules/cross-spawn/index.js
[1] Module not found: Error: Can't resolve 'spawn-sync' in '/home/redacted/Documents/open_source/oni/node_modules/cross-spawn'
[1]  @ ./node_modules/cross-spawn/index.js 33:26-47
[1]  @ ./node_modules/shell-env/node_modules/execa/index.js
[1]  @ ./node_modules/shell-env/index.js
[1]  @ ./browser/src/Plugins/Api/Process.ts
[1]  @ ./browser/src/Plugins/PluginInstaller.ts
[1]  @ ./browser/src/Plugins/PluginManager.ts
[1]  @ ./browser/src/App.ts
[1]  @ ./browser/src/index.tsx
[1]  @ multi (webpack)-dev-server/client?http://localhost:8191 ./browser/src/index.tsx

Since it's just a warning, I'm still able to recompile and build stuff :man_shrugging:.

Digging a bit deeper (https://github.com/moxystudio/node-cross-spawn/issues/87 and the source code), requiring spawn-sync is only ever supposed to trigger if you're on an reallllly old version of Node where the inbuilt child_process.spawnSync doesn't exist. Given that we're all encountering it on various versions of node, I think there's something much more whacky going on, as spawn-sync is supposed to be a polyfill.

The error with cross-spawn is a bit of a rabbit hole as it first appeared after we integrated shell-env which helps us get a user's PATH and ENV variables for nvim the issue is that somehwere down the line of dependences I believe one of execa dependencies requires spawn-sync I found a thread about this around the time, where the package contributors were discussing dropping support for the old version of node so that it could be removed but no one has put in a PR yet.

As far as I'm aware though, although it is annoying its a warning that shouldn't interfere with actually building or running oni

I have also encountered this issue.

As far as I'm aware though, although it is annoying its a warning that shouldn't interfere with actually building or running oni

How does one run Oni after building if the npm link step fails as in this case?

I tried npm run start as explained in the development page but I was greeted by a message box:

screen shot 2018-04-15 at 3 13 24 pm

If I wait a while, webpack will output some errors, too:

donviszneki@Dons-MacBook-Pro ~/oni$ npm run launch

> [email protected] launch /Users/donviszneki/oni
> electron lib/main/src/main.js

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] launch: `electron lib/main/src/main.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] launch script.

[2] 3:16:05 PM - Starting compilation in watch mode...
[2] 
[2] 
[1] Project is running at http://localhost:8191/
[1] webpack output is served from http://localhost:8191/
[1] ts-loader: Using [email protected] and /Users/donviszneki/oni/browser/tsconfig.json
[2] 3:16:08 PM - Compilation complete. Watching for file changes.
[2] 
[2] 
[1] Hash: 195bfe9af97f6bba85e5
[1] Version: webpack 3.5.3
[1] Time: 22090ms
[1]        Asset     Size                                                                                       Chunks                    Chunk Names
[1] 26.bundle.js   646 kB                                                                                    26, 1, 30  [emitted]  [big]  
[1]  0.bundle.js  10.8 MB  0, 1, 4, 6, 7, 8, 9, 11, 13, 16, 18, 19, 20, 23, 24, 25, 29, 30, 31, 32, 33, 34, 36, 39, 43  [emitted]  [big]  
[1]  2.bundle.js  9.95 MB                                   2, 1, 4, 9, 13, 16, 20, 23, 25, 29, 30, 31, 32, 34, 39, 43  [emitted]  [big]  
[1]  3.bundle.js  8.54 MB                                                          3, 1, 4, 16, 20, 23, 29, 30, 32, 39  [emitted]  [big]  
[1]  4.bundle.js  4.98 MB                                                                                 4, 1, 16, 39  [emitted]  [big]  
[1]  5.bundle.js  6.33 MB                                                   5, 1, 6, 9, 16, 23, 24, 25, 29, 30, 32, 39  [emitted]  [big]  
[1]  6.bundle.js  5.96 MB                                                              6, 1, 9, 16, 23, 25, 29, 30, 39  [emitted]  [big]  
[1]  7.bundle.js  5.76 MB                                                              7, 1, 9, 16, 23, 25, 29, 30, 39  [emitted]  [big]  
[1]  8.bundle.js  5.76 MB                                                              8, 1, 9, 16, 23, 25, 29, 30, 39  [emitted]  [big]  
[1]  9.bundle.js  5.75 MB                                                                 9, 1, 16, 23, 25, 29, 30, 39  [emitted]  [big]  
[1] 10.bundle.js   3.2 MB                                                                10, 1, 16, 20, 24, 29, 30, 39  [emitted]  [big]  
[1] 11.bundle.js  3.06 MB                                                                11, 1, 16, 20, 23, 29, 30, 39  [emitted]  [big]  
[1] 12.bundle.js  2.98 MB                                                                    12, 1, 16, 20, 29, 30, 39  [emitted]  [big]  
[1] 13.bundle.js   2.8 MB                                                                               13, 29, 31, 34  [emitted]  [big]  
[1] 14.bundle.js  2.96 MB                                                                    14, 1, 16, 20, 29, 30, 39  [emitted]  [big]  
[1] 15.bundle.js  2.95 MB                                                                            15, 1, 16, 18, 39  [emitted]  [big]  
[1] 16.bundle.js  1.06 MB                                                                                    16, 1, 39  [emitted]  [big]  
[1] 17.bundle.js  2.57 MB                                                                                       17, 18  [emitted]  [big]  
[1] 18.bundle.js  2.57 MB                                                                                           18  [emitted]  [big]  
[1] 19.bundle.js  2.49 MB                                                                                   19, 29, 34  [emitted]  [big]  
[1] 20.bundle.js  2.31 MB                                                                                    20, 1, 29  [emitted]  [big]  
[1] 21.bundle.js   607 kB                                                                                21, 1, 23, 45  [emitted]  [big]  
[1] 22.bundle.js   797 kB                                                                                           22  [emitted]  [big]  
[1] 23.bundle.js   565 kB                                                                                           23  [emitted]  [big]  
[1] 24.bundle.js   568 kB                                                                                           24  [emitted]  [big]  
[1] 25.bundle.js  2.12 MB                                                                                       25, 29  [emitted]  [big]  
[1]  1.bundle.js    13 kB                                                                                            1  [emitted]         
[1] 27.bundle.js  1.96 MB                                                                                       27, 29  [emitted]  [big]  
[1] 28.bundle.js  1.95 MB                                                                                       28, 29  [emitted]  [big]  
[1] 29.bundle.js  1.95 MB                                                                                           29  [emitted]  [big]  
[1] 30.bundle.js   443 kB                                                                                        30, 1  [emitted]  [big]  
[1] 31.bundle.js   411 kB                                                                                           31  [emitted]  [big]  
[1] 32.bundle.js   408 kB                                                                                           32  [emitted]  [big]  
[1] 33.bundle.js   393 kB                                                                                           33  [emitted]  [big]  
[1] 34.bundle.js   402 kB                                                                                           34  [emitted]  [big]  
[1] 35.bundle.js   390 kB                                                                                           35  [emitted]  [big]  
[1] 36.bundle.js   387 kB                                                                                           36  [emitted]  [big]  
[1] 37.bundle.js   349 kB                                                                                        37, 1  [emitted]  [big]  
[1] 38.bundle.js  98.5 kB                                                                                           38  [emitted]         
[1] 39.bundle.js   195 kB                                                                                           39  [emitted]         
[1] 40.bundle.js   140 kB                                                                                           40  [emitted]         
[1] 41.bundle.js  41.3 kB                                                                                        41, 1  [emitted]         
[1] 42.bundle.js  18.4 kB                                                                                        42, 1  [emitted]         
[1] 43.bundle.js  27.5 kB                                                                                           43  [emitted]         
[1] 44.bundle.js  9.02 kB                                                                                           44  [emitted]         
[1] 45.bundle.js  3.48 kB                                                                                           45  [emitted]         
[1] 46.bundle.js  22.2 kB                                                                                           46  [emitted]         
[1] 47.bundle.js  5.16 kB                                                                                           47  [emitted]         
[1] 48.bundle.js   189 kB                                                                                           48  [emitted]         
[1] 49.bundle.js  77.3 kB                                                                                           49  [emitted]         
[1] 50.bundle.js  7.33 kB                                                                                           50  [emitted]         
[1]    bundle.js  1.66 MB                                                                                           51  [emitted]  [big]  main
[1]   [99] ./browser/src/Log.ts 1.02 kB {51} [built]
[1]  [104] ./browser/src/Services/CommandManager.ts 2.26 kB {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {14} {15} {16} {20} {21} {26} {30} {37} {41} {42} [built]
[1]  [112] ./browser/src/App.ts 13.9 kB {51} [built]
[1]  [127] ./node_modules/strip-ansi/index.js 161 bytes {51} [built]
[1]  [138] multi (webpack)-dev-server/client?http://localhost:8191 ./browser/src/index.tsx 40 bytes {51} [built]
[1]  [139] (webpack)-dev-server/client?http://localhost:8191 5.83 kB {51} [built]
[1]  [141] ./node_modules/loglevel/lib/loglevel.js 7.86 kB {51} [built]
[1]  [142] (webpack)-dev-server/client/socket.js 856 bytes {51} [built]
[1]  [143] ./node_modules/sockjs-client/lib/entry.js 244 bytes {51} [built]
[1]  [197] (webpack)-dev-server/client/overlay.js 3.6 kB {51} [built]
[1]  [202] (webpack)/hot nonrecursive ^\.\/log$ 170 bytes {51} [built]
[1]  [204] (webpack)/hot/emitter.js 77 bytes {51} [built]
[1]  [205] ./browser/src/index.tsx 1.03 kB {51} 
[1] webpack: Failed to compile.
[1] [built]
[1]  [292] ./browser/src/Services/Notifications/index.ts 850 bytes {0} {2} {3} {4} [built]
[1]  [454] ./node_modules/lodash/values.js 733 bytes {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {14} {15} {16} {20} {21} {26} {30} {37} {41} {42} [built]
[1]     + 1758 hidden modules
[1] 
[1] WARNING in ./node_modules/cross-spawn/index.js
[1] Module not found: Error: Can't resolve 'spawn-sync' in '/Users/donviszneki/oni/node_modules/cross-spawn'
[1]  @ ./node_modules/cross-spawn/index.js 32:26-47
[1]  @ ./node_modules/execa/index.js
[1]  @ ./node_modules/shell-env/index.js
[1]  @ ./browser/src/Plugins/Api/Process.ts
[1]  @ ./browser/src/Plugins/PluginInstaller.ts
[1]  @ ./browser/src/Plugins/PluginManager.ts
[1]  @ ./browser/src/App.ts
[1]  @ ./browser/src/index.tsx
[1]  @ multi (webpack)-dev-server/client?http://localhost:8191 ./browser/src/index.tsx
[1] 
[1] ERROR in ./browser/src/Editor/NeovimEditor/HoverRenderer.tsx
[1] (124,21): error TS2322: Type '{ children: any; style: { webkitPaddingStart: string; }; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLUListElement>, HTMLUListElement>'.
[1]   Type '{ children: any; style: { webkitPaddingStart: string; }; }' is not assignable to type 'HTMLAttributes<HTMLUListElement>'.
[1]     Types of property 'style' are incompatible.
[1]       Type '{ webkitPaddingStart: string; }' is not assignable to type 'CSSProperties'.
[1]         Property 'webkitPaddingStart' does not exist on type 'CSSProperties'.
[1] 
[1] ERROR in ./browser/src/UI/components/WindowTitle.tsx
[1] (34,13): error TS2322: Type '{ height: string; lineHeight: string; zoom: number; backgroundColor: string; color: string; textA...' is not assignable to type 'CSSProperties'.
[1]   Object literal may only specify known properties, and 'WebkitAppRegion' does not exist in type 'CSSProperties'.
[1] 
[1] ERROR in ./browser/src/UI/components/WindowTitle.tsx
[1] Module build failed: Error: Typescript emitted no output for /Users/donviszneki/oni/browser/src/UI/components/WindowTitle.tsx.
[1]     at successLoader (/Users/donviszneki/oni/node_modules/ts-loader/dist/index.js:39:15)
[1]     at Object.loader (/Users/donviszneki/oni/node_modules/ts-loader/dist/index.js:21:12)
[1]  @ ./browser/src/UI/Shell/ShellView.tsx 11:0-58
[1]  @ ./browser/src/UI/Shell/Shell.tsx
[1]  @ ./browser/src/UI/Shell/index.ts
[1]  @ ./browser/src/App.ts
[1]  @ ./browser/src/index.tsx
[1]  @ multi (webpack)-dev-server/client?http://localhost:8191 ./browser/src/index.tsx
[1] 
[1] ERROR in ./browser/src/Editor/NeovimEditor/HoverRenderer.tsx
[1] Module build failed: Error: Typescript emitted no output for /Users/donviszneki/oni/browser/src/Editor/NeovimEditor/HoverRenderer.tsx.
[1]     at successLoader (/Users/donviszneki/oni/node_modules/ts-loader/dist/index.js:39:15)
[1]     at Object.loader (/Users/donviszneki/oni/node_modules/ts-loader/dist/index.js:21:12)
[1]  @ ./browser/src/Editor/NeovimEditor/NeovimEditor.tsx 33:0-48
[1]  @ ./browser/src/Editor/NeovimEditor/index.ts
[1]  @ ./browser/src/Editor/OniEditor/OniEditor.tsx
[1]  @ ./browser/src/Editor/OniEditor/index.ts
[1]  @ ./browser/src/startEditors.ts
[1]  @ ./browser/src/App.ts
[1]  @ ./browser/src/index.tsx
[1]  @ multi (webpack)-dev-server/client?http://localhost:8191 ./browser/src/index.tsx
[0] npm
[0]  ERR! code ELIFECYCLE
[0] npm ERR! errno 1
[0] npm 
[0] ERR! [email protected] start-hot: `cross-env ONI_WEBPACK_LOAD=1 NODE_ENV=development electron lib/main/src/main.js`
[0] npm ERR! Exit status 1
[0] npm ERR! 
[0] npm ERR! Failed at the [email protected] start-hot script.
[0] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[0] 
[0] npm ERR! A complete log of this run can be found in:
[0] npm ERR!     /Users/donviszneki/.npm/_logs/2018-04-15T22_16_34_786Z-debug.log
[0] npm run start-hot exited with code 1
--> Sending SIGTERM to other processes..
[1] npm run watch:browser exited with code 0
[2] npm run watch:plugins exited with code null
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `concurrently --kill-others "npm run start-hot" "npm run watch:browser" "npm run watch:plugins"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/donviszneki/.npm/_logs/2018-04-15T22_16_35_986Z-debug.log

I was able to get it to build by downgrading to node v8.10.0

This worked for me, too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  23Comments

saibing picture saibing  路  21Comments

bryphe picture bryphe  路  19Comments

rococode picture rococode  路  20Comments

bryphe picture bryphe  路  29Comments