Vscode-vsce: vscode:prepublish: `tsc -p ./` keep throwing Exit status 2

Created on 19 Apr 2017  路  10Comments  路  Source: microsoft/vscode-vsce

I just can't publish my extension anymore.
It just worked fine before I ran npm update.

Now it says all day, no matter what:

    npm ERR! Darwin 15.6.0
    npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "vscode:prepublish"
    npm ERR! node v6.10.2
    npm ERR! npm  v3.10.10
    npm ERR! code ELIFECYCLE
    npm ERR! [email protected] vscode:prepublish: `tsc -p ./`
    npm ERR! Exit status 2
    npm ERR! 
    npm ERR! Failed at the [email protected] vscode:prepublish script 'tsc -p ./'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.

See dependencies in package.json to get the full picture. I tried with countless node versions (6.x to 7.x), no luck with any.

Please help, I have valuable features to publish for user all around stuck into my MacBook. 馃槥

Most helpful comment

Also it useful to execute only npm run vscode:prepublish and fix warnings and errors. Then execute needed command.
Unfortunately vsce does not show scripts's warnings and errors.

All 10 comments

Full npm-debug.log if that helps:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'vscode:prepublish' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prevscode:prepublish',
4 verbose run-script   'vscode:prepublish',
4 verbose run-script   'postvscode:prepublish' ]
5 info lifecycle [email protected]~prevscode:prepublish: [email protected]
6 silly lifecycle [email protected]~prevscode:prepublish: no script for prevscode:prepublish, continuing
7 info lifecycle [email protected]~vscode:prepublish: [email protected]
8 verbose lifecycle [email protected]~vscode:prepublish: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~vscode:prepublish: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/eppz/.vscode/extensions/eppz.eppz-code/node_modules/.bin:/Applications/MAMP/bin/php/php5.4.42/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/eppz/Developer/Android_SDK/tools:/Users/eppz/Developer/Android_SDK/platform-tools
10 verbose lifecycle [email protected]~vscode:prepublish: CWD: /Users/eppz/.vscode/extensions/eppz.eppz-code
11 silly lifecycle [email protected]~vscode:prepublish: Args: [ '-c', 'tsc -p ./' ]
12 silly lifecycle [email protected]~vscode:prepublish: Returned: code: 2  signal: null
13 info lifecycle [email protected]~vscode:prepublish: Failed to exec vscode:prepublish script
14 verbose stack Error: [email protected] vscode:prepublish: `tsc -p ./`
14 verbose stack Exit status 2
14 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:886:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd /Users/eppz/.vscode/extensions/eppz.eppz-code
17 error Darwin 15.6.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "vscode:prepublish"
19 error node v6.10.2
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error [email protected] vscode:prepublish: `tsc -p ./`
22 error Exit status 2
23 error Failed at the [email protected] vscode:prepublish script 'tsc -p ./'.
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 eppz-code package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     tsc -p ./
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs eppz-code
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls eppz-code
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Manually (!) deleting entire node_modules content, then reinstall everything (with npm install) simply solved the issue.

kelvin@gnux:~/rls_vscode> vsce package
Executing prepublish script 'npm run vscode:prepublish'...
Error: Command failed: npm run vscode:prepublish
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] vscode:prepublish: `tsc -p ./`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] vscode:prepublish 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!     /home/kelvin/.npm/_logs/2017-06-17T06_43_54_936Z-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/home/kelvin/.nvm/versions/node/v8.1.2/bin/node',
1 verbose cli   '/home/kelvin/.nvm/versions/node/v8.1.2/bin/npm',
1 verbose cli   'run',
1 verbose cli   'vscode:prepublish' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prevscode:prepublish',
4 verbose run-script   'vscode:prepublish',
4 verbose run-script   'postvscode:prepublish' ]
5 info lifecycle [email protected]~prevscode:prepublish: [email protected]
6 silly lifecycle [email protected]~prevscode:prepublish: no script for prevscode:prepublish, continuing
7 info lifecycle [email protected]~vscode:prepublish: [email protected]
8 verbose lifecycle [email protected]~vscode:prepublish: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~vscode:prepublish: PATH: /home/kelvin/.nvm/versions/node/v8.1.2/lib/node_modules/npm/bin/node-gyp-bin:/home/kelvin/rls_vscode/node_modules/.bin:/home/kelvin/.linuxbrew/bin:/home/kelvinw/.cabal/bin:/home/kelvin/.nvm/versions/node/v8.1.2/bin:/home/kelvin/bin:/home/kelvin/ruby:/opt/bin:/usr/local/bin:/usr/local/share/python:/home/kelvin/gocode/bin:/usr/local/opt/go/libexec/bin:/home/kelvin/Qt5.7/5.7/gcc_64/bin/:/home/kelvin/.cargo/bin:/opt/tools/jdk/jdk1.8.0_121/bin://opt/tools/jdk/jdk1.8.0_121/jre/bin:/home/kelvin/.cargo/bin:/home/kelvin/.rvm/gems/ruby-2.4.0/bin:/home/kelvin/.rvm/gems/ruby-2.4.0@global/bin:/home/kelvin/.rvm/rubies/ruby-2.4.0/bin:/home/kelvin/.local/bin:/home/kelvin/bin:/home/kelvin/tools/maven/bin:/opt/tools/jdk/jdk1.8.0_121/bin://opt/tools/jdk/jdk1.8.0_121/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/kelvin/.rvm/bin:/home/kelvin/.rvm/bin:/home/kelvin/gocode/bin:/home/kelvin/go/bin:/home/kelvin/tools/android/adt-bundle-linux-x86_64-20140702/sdk//tools:/home/kelvin/tools/android/adt-bundle-linux-x86_64-20140702/sdk//platform-tools:/opt/gradle/gradle-3.5/bin:/home/kelvin/.rvm/bin:/home/kelvin/.rvm/bin:/home/kelvin/.vim/plugged/fzf/bin
10 verbose lifecycle [email protected]~vscode:prepublish: CWD: /home/kelvin/rls_vscode
11 silly lifecycle [email protected]~vscode:prepublish: Args: [ '-c', 'tsc -p ./' ]
12 silly lifecycle [email protected]~vscode:prepublish: Returned: code: 2  signal: null
13 info lifecycle [email protected]~vscode:prepublish: Failed to exec vscode:prepublish script
14 verbose stack Error: [email protected] vscode:prepublish: `tsc -p ./`
14 verbose stack Exit status 2
14 verbose stack     at EventEmitter.<anonymous> (/home/kelvin/.nvm/versions/node/v8.1.2/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
14 verbose stack     at emitTwo (events.js:125:13)
14 verbose stack     at EventEmitter.emit (events.js:213:7)
14 verbose stack     at ChildProcess.<anonymous> (/home/kelvin/.nvm/versions/node/v8.1.2/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:125:13)
14 verbose stack     at ChildProcess.emit (events.js:213:7)
14 verbose stack     at maybeClose (internal/child_process.js:897:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
15 verbose pkgid [email protected]
16 verbose cwd /home/kelvin/rls_vscode
17 verbose Linux 4.10.0-22-generic
18 verbose argv "/home/kelvin/.nvm/versions/node/v8.1.2/bin/node" "/home/kelvin/.nvm/versions/node/v8.1.2/bin/npm" "run" "vscode:prepublish"
19 verbose node v8.1.2
20 verbose npm  v5.0.3
21 error code ELIFECYCLE
22 error errno 2
23 error [email protected] vscode:prepublish: `tsc -p ./`
23 error Exit status 2
24 error Failed at the [email protected] vscode:prepublish script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 2, true ]

Manually (!) deleting entire node_modules AND package-lock.json content, then reinstall everything (with npm install) simply solved the issue.

Could you help to share more details about the solution? The node_module and package-lock,json are generated again after running 'npm install', then it goes into the loop.

Hi! I am having the same issue as both of the people above, however the suggested solution is not working. Is there any other issues that could be causing this?

I have attached my full log below:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/9.8.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'vscode:prepublish' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prevscode:prepublish',
4 verbose run-script   'vscode:prepublish',
4 verbose run-script   'postvscode:prepublish' ]
5 info lifecycle [email protected]~prevscode:prepublish: [email protected]
6 info lifecycle [email protected]~vscode:prepublish: [email protected]
7 verbose lifecycle [email protected]~vscode:prepublish: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~vscode:prepublish: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/jamie/vscode-python/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle [email protected]~vscode:prepublish: CWD: /Users/jamie/vscode-python
10 silly lifecycle [email protected]~vscode:prepublish: Args: [ '-c', 'tsc -p ./' ]
11 silly lifecycle [email protected]~vscode:prepublish: Returned: code: 2  signal: null
12 info lifecycle [email protected]~vscode:prepublish: Failed to exec vscode:prepublish script
13 verbose stack Error: [email protected] vscode:prepublish: `tsc -p ./`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack     at EventEmitter.emit (events.js:180:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:180:13)
13 verbose stack     at maybeClose (internal/child_process.js:936:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/jamie/vscode-python
16 verbose Darwin 17.4.0
17 verbose argv "/usr/local/Cellar/node/9.8.0/bin/node" "/usr/local/bin/npm" "run" "vscode:prepublish"
18 verbose node v9.8.0
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] vscode:prepublish: `tsc -p ./`
22 error Exit status 2
23 error Failed at the [email protected] vscode:prepublish script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
~                                                                                                      
~                                                                                                      
~                                      

vsce package fails for me with the exact same error as for @jamiesarahg. When I delete node_modules and package-lock.json and run npm install, vsce package fails with another error:

Executing prepublish script 'npm run vscode:prepublish'...
Error: stdout maxBuffer exceeded

EDIT: When I ran tsc -p ./ manually, it showed some compilation errors in my code. After fixing those, the vsce package command finally succeeded. The "stdout maxBuffer exceeded" error message was because of another issue with my code where tsc would output lots of error messages and fill some internal buffer.

i was having some warnings in my TS file. after removing these it worked.

Also it useful to execute only npm run vscode:prepublish and fix warnings and errors. Then execute needed command.
Unfortunately vsce does not show scripts's warnings and errors.

The command will work if you remove the unused imports from typescript files.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandoncc picture brandoncc  路  6Comments

joaomoreno picture joaomoreno  路  6Comments

mlewand picture mlewand  路  3Comments

felixfbecker picture felixfbecker  路  6Comments

equinusocio picture equinusocio  路  4Comments