Trouble Building VSCode Extension

I’m trying to build the VSCode extension for sourcekit-lsp as per its README but I get failures. This is on a fresh install of Ubuntu 18.04, with the Swift 5.2.2 toolchain. Here’s the output of the log after running npm run createDevPackage:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'createDevPackage' ]
2 info using npm@3.5.2
3 info using node@v8.10.0
4 verbose run-script [ 'precreateDevPackage',
4 verbose run-script   'createDevPackage',
4 verbose run-script   'postcreateDevPackage' ]
5 info lifecycle sourcekit-lsp@0.0.1~precreateDevPackage: sourcekit-lsp@0.0.1
6 silly lifecycle sourcekit-lsp@0.0.1~precreateDevPackage: no script for precreateDevPackage, continuing
7 info lifecycle sourcekit-lsp@0.0.1~createDevPackage: sourcekit-lsp@0.0.1
8 verbose lifecycle sourcekit-lsp@0.0.1~createDevPackage: unsafe-perm in lifecycle true
9 verbose lifecycle sourcekit-lsp@0.0.1~createDevPackage: PATH: /usr/share/npm/bin/node-gyp-bin:/home/jeff/Projects/Open-Source/sourcekit-lsp/Editors/vscode/node_modules/.bin:/usr/share/swift/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
10 verbose lifecycle sourcekit-lsp@0.0.1~createDevPackage: CWD: /home/jeff/Projects/Open-Source/sourcekit-lsp/Editors/vscode
11 silly lifecycle sourcekit-lsp@0.0.1~createDevPackage: Args: [ '-c',
11 silly lifecycle   'npm install && ./node_modules/.bin/vsce package -o ./out/sourcekit-lsp-vscode-dev.vsix' ]
12 silly lifecycle sourcekit-lsp@0.0.1~createDevPackage: Returned: code: 1  signal: null
13 info lifecycle sourcekit-lsp@0.0.1~createDevPackage: Failed to exec createDevPackage script
14 verbose stack Error: sourcekit-lsp@0.0.1 createDevPackage: `npm install && ./node_modules/.bin/vsce package -o ./out/sourcekit-lsp-vscode-dev.vsix`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/usr/share/npm/lib/utils/lifecycle.js:232:16)
14 verbose stack     at emitTwo (events.js:126:13)
14 verbose stack     at EventEmitter.emit (events.js:214:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:126:13)
14 verbose stack     at ChildProcess.emit (events.js:214:7)
14 verbose stack     at maybeClose (internal/child_process.js:925:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
15 verbose pkgid sourcekit-lsp@0.0.1
16 verbose cwd /home/jeff/Projects/Open-Source/sourcekit-lsp/Editors/vscode
17 error Linux 5.3.0-51-generic
18 error argv "/usr/bin/node" "/usr/bin/npm" "run" "createDevPackage"
19 error node v8.10.0
20 error npm  v3.5.2
21 error code ELIFECYCLE
22 error sourcekit-lsp@0.0.1 createDevPackage: `npm install && ./node_modules/.bin/vsce package -o ./out/sourcekit-lsp-vscode-dev.vsix`
22 error Exit status 1
23 error Failed at the sourcekit-lsp@0.0.1 createDevPackage script 'npm install && ./node_modules/.bin/vsce package -o ./out/sourcekit-lsp-vscode-dev.vsix'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the sourcekit-lsp package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     npm install && ./node_modules/.bin/vsce package -o ./out/sourcekit-lsp-vscode-dev.vsix
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs sourcekit-lsp
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls sourcekit-lsp
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Are there any updated guidelines on this?

Hmm, haven't seen that before. I just tried a clean build and I do not see this issue with either Ubuntu 18.04 (using docker) or macOS.

Maybe this is the issue? I have a much newer version:


$ npm -v


$ npm -v
1 Like

Yep, that was it. I'm not sure why I was on such an old npm version, but updating it from inside npm fixed it! Thanks!

1 Like