NPM fails installing and building due to failing requests to private Microsoft npm repos
opened this issue · comments
Environment data
dotnet --info
output: Latest
VS Code version: Latest
C# Extension version:
Steps to reproduce
- run
npm install
throws error
npx gulp 'vsix:release:package'
[14:07:53] Requiring external module ts-node/register
[14:07:59] Using gulpfile /free-omnisharp-vscode/gulpfile.ts
[14:07:59] Starting 'vsix:release:package'...
starting node /free-omnisharp-vscode/node_modules/vsce/out/vsce package
Executing prepublish script 'npm run vscode:prepublish'...
ERROR Command failed: npm run vscode:prepublish
npm ERR! code 2
npm ERR! path /free-omnisharp-vscode
npm ERR! command failed
npm ERR! command sh -c tsc -p ./ && webpack --mode production
[14:08:08] 'vsix:release:package' errored after 9.26 s
[14:08:08] Error: process exited with code 1
at ChildProcess.<anonymous> (/free-omnisharp-vscode/node_modules/async-child-process/lib/join.js:25:22)
at ChildProcess.emit (events.js:314:20)
at ChildProcess.EventEmitter.emit (domain.js:506:15)
at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
at Process.callbackTrampoline (internal/async_hooks.js:126:14)
npm ERR! code 1
npm ERR! path /free-omnisharp-vscode
npm ERR! command failed
npm ERR! command sh -c gulp "vsix:release:package"
npm ERR! A complete log of this run can be found in:
Cannot build.
It builds successfully on the ci. These errors must be related to your environment.
For me it successfully builds locally , here is the output
➜ free-omnisharp-vscode git:(master) node:(v14.15.4) npx gulp 'vsix:release:package'
[01:26:14] Requiring external module ts-node/register
[01:26:20] Using gulpfile ~/Devel/github/free-omnisharp-vscode/gulpfile.ts
[01:26:20] Starting 'vsix:release:package'...
starting node /home/msammy/Devel/github/free-omnisharp-vscode/node_modules/vsce/out/vsce package
Executing prepublish script 'npm run vscode:prepublish'...
> csharp@1.23.11 vscode:prepublish
> tsc -p ./ && webpack --mode production
Hash: c150dfde83c1eb6ed0ed
Version: webpack 4.29.3
Time: 29775ms
Built at: 02/17/2021 1:27:00 AM
Asset Size Chunks Chunk Names
extension.js 1.02 MiB 0 [emitted] main
extension.js.map 3.81 MiB 0 [emitted] main
Entrypoint main = extension.js extension.js.map
[2] external "vscode" 42 bytes {0} [built]
[21] ./src/omnisharp/loggingEvents.ts 21.8 KiB {0} [built]
[26] ./src/common.ts 7.81 KiB {0} [built]
[155] ./src/omnisharp/extension.ts 14.1 KiB {0} [built]
[164] ./src/packageManager/downloadAndInstallPackages.ts 4.62 KiB {0} [built]
[184] ./src/packageManager/isValidDownload.ts 1.34 KiB {0} [built]
[185] ./src/platform.ts 8.21 KiB {0} [built]
[186] ./src/constants/CSharpExtensionId.ts 518 bytes {0} [built]
[188] ./src/omnisharp/decompilationPrompt.ts 3.98 KiB {0} [built]
[198] ./src/main.ts 13.1 KiB {0} [built]
[335] ./src/coreclr-debug/activate.ts 10.5 KiB {0} [built]
[337] ./src/observers/WarningMessageObserver.ts 2.68 KiB {0} [built]
[339] ./src/observers/CsharpChannelObserver.ts 1.32 KiB {0} [built]
[340] ./src/observers/CsharpLoggerObserver.ts 6.45 KiB {0} [built]
[342] ./src/observers/DotnetChannelObserver.ts 1.03 KiB {0} [built]
+ 439 hidden modules
WARNING in ./node_modules/vscode-nls/lib/main.js 60:49-88
Critical dependency: the request of a dependency is an expression
@ ./src/features/json/projectJSONContribution.ts
@ ./src/features/json/jsonContributions.ts
@ ./src/main.ts
WARNING in ./node_modules/vscode-nls/lib/main.js 215:19-66
Critical dependency: the request of a dependency is an expression
@ ./src/features/json/projectJSONContribution.ts
@ ./src/features/json/jsonContributions.ts
@ ./src/main.ts
WARNING in ./node_modules/vscode-nls/lib/main.js 228:23-52
Critical dependency: the request of a dependency is an expression
@ ./src/features/json/projectJSONContribution.ts
@ ./src/features/json/jsonContributions.ts
@ ./src/main.ts
WARNING in ./node_modules/vscode-nls/lib/main.js 229:19-72
Critical dependency: the request of a dependency is an expression
@ ./src/features/json/projectJSONContribution.ts
@ ./src/features/json/jsonContributions.ts
@ ./src/main.ts
WARNING in ./node_modules/vscode-nls/lib/main.js 338:23-41
Critical dependency: the request of a dependency is an expression
@ ./src/features/json/projectJSONContribution.ts
@ ./src/features/json/jsonContributions.ts
@ ./src/main.ts
WARNING in ./node_modules/vscode-nls/lib/main.js 416:23-53
Critical dependency: the request of a dependency is an expression
@ ./src/features/json/projectJSONContribution.ts
@ ./src/features/json/jsonContributions.ts
@ ./src/main.ts
DONE Packaged: /home/msammy/Devel/github/free-omnisharp-vscode/csharp-1.23.11.vsix (18 files, 350.15KB)
[01:27:05] Finished 'vsix:release:package' after 45 s
I can't decide what caused the error with these provided info about your environment
It builds successfully on the ci. These errors must be related to your environment.
Can you also publish CI build version of
vsix
file onmaster
?
Sure! opened #16 to track this.
It seems the issue is because
npm i
is trying to connect to private Microsoft npm repository to restore packages, not sure why its there inomnisharp/omnisharp-vscode
error An unexpected error occurred: "https://msazure.pkgs.visualstudio.com/_packaging/MLS/npm/registry/emitter-component/-/emitter-component-1.1.1.tgz: Request failed \"401 Unauthorized\"".
It never showed up for me at installation, but I will investigate the cause of this.
found this in package-lock.json and others similiar to it:
btw are you using latest npm vrsion (7.5.x)?
Also the CI now provides build artifacts (#17)
Let's close that issue. User is gone and it was probably his environment.