Skip to content

NPM Install fails when tsconfig is present in VSCode workspace #16955

Description

@mjbvz

TypeScript Version: 2.3.4
NPM version: 5.0.4

Repo

  1. In vscode, create a workspace:

app.ts:

import_from'lodash'

tsconfig.json

{
"compilerOptions": { }
}

package.json:

{"name": "test","version": "1.0.0","description": "","main": "index.js","dependencies": {"lodash": "^4.16.4","rxjs": "^5.4.2"},"devDependencies": {"@types/lodash": "^4.14.68","typescript": "^2.4.1"},"scripts": {"test": "echo \"Error: no test specified\" && exit 1"},"keywords": [],"author": "","license": "ISC"}
  1. With code open, open the ts file.

  2. In the a terminal for the current workspace, run npm install

Bug

PS C:\source\test> npm i
npm WARN test@1.0.0 No description
npm WARN test@1.0.0 No repository field.
npm ERR! path C:\source\test\node_modules\@types\lodash
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\source\test\node_modules\@types\lodash' -> 'C:\source\test\node_modules\@types\.lodash.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\matb.REDMOND\AppData\Roaming\npm-cache\_logs\2017-07-05T20_55_16_461Z-debug.log

Here are the file handles:

> C:\Users\matb.REDMOND\Downloads\Handle\handle.exe lodash
Code.exe pid: 21136 type: File 534: C:\source\test\node_modules\.staging\@types\lodash-4e92de43\tem plate
Code.exe pid: 21136 type: File 5E0: C:\source\test\node_modules\.staging\@types\lodash-4e92de43

and the process info for pid 21136:

"C:\Program Files (x86)\Microsoft VS Code\Code.exe" "c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\typescript\out\utils\electronForkStart" "c:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js" --useSingleInferredProject --enableTelemetry --cancellationPipeName \\.\pipe\vscode-tscancellation-70cad40d58dfe783e0f8-sock*

Seems that the tsserver is holding onto these files, breaking npm install

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issueVS Code TrackedThere is a VS Code equivalent to this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions