Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm ERR! extraneous: <repo>\node_modules\<linked-project>\node_modules\<dev-dependency> #471

Closed
robpaveza opened this issue Jul 28, 2020 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@robpaveza
Copy link

My project is contained within a monorepo; the extension requires a library shared by a frontend component and the Extension itself.

When I try to run vsce package, I get the following output:

npm ERR! missing: @types/mocha@7.0.2, required by network-console-shared@0.9.1-preview
npm ERR! missing: webpack@4.42.1, required by network-console-shared@0.9.1-preview
npm ERR! extraneous: @types/hash-sum@1.0.0 C:\projects\edge-devtools-network-console\packages\network-console-vscode-extension\node_modules\network-console-shared\node_modules\@types\hash-sum
npm ERR! extraneous: @types/mocha@7.0.2 C:\projects\edge-devtools-network-console\packages\network-console-vscode-extension\node_modules\network-console-shared\node_modules\@types\mocha
npm ERR! extraneous: dts-bundle-webpack@1.0.2 C:\projects\edge-devtools-network-console\packages\network-console-vscode-extension\node_modules\network-console-shared\node_modules\dts-bundle-webpack
npm ERR! extraneous: mocha@7.1.1 C:\projects\edge-devtools-network-console\packages\network-console-vscode-extension\node_modules\network-console-shared\node_modules\mocha
npm ERR! extraneous: ts-loader@6.2.2 C:\projects\edge-devtools-network-console\packages\network-console-vscode-extension\node_modules\network-console-shared\node_modules\ts-loader
npm ERR! extraneous: tslint@6.1.1 C:\projects\edge-devtools-network-console\packages\network-console-vscode-extension\node_modules\network-console-shared\node_modules\tslint
npm ERR! extraneous: typescript@3.8.3 C:\projects\edge-devtools-network-console\packages\network-console-vscode-extension\node_modules\network-console-shared\node_modules\typescript
npm ERR! extraneous: webpack@4.42.1 C:\projects\edge-devtools-network-console\packages\network-console-vscode-extension\node_modules\network-console-shared\node_modules\webpack
npm ERR! extraneous: webpack-cli@3.3.11 C:\projects\edge-devtools-network-console\packages\network-console-vscode-extension\node_modules\network-console-shared\node_modules\webpack-cli

The commit hash is here: robpaveza/edge-devtools-network-console@85733dc

To repro from a clean repo, here's what I did:

tmp>git clone https://github.com/robpaveza/edge-devtools-network-console.git
tmp>cd edge-devtools-network-console
tmp\edge-devtools-network-console>npm i
tmp\edge-devtools-network-console>set SKIP_PREFLIGHT_CHECK=true
tmp\edge-devtools-network-console>npm run install-and-build
tmp\edge-devtools-network-console>cd packages\network-console-vscode-extension
tmp\edge-devtools-network-console\packages\network-console-vscode-extension>mklink .\frontend ..\devtools-network-console\build
tmp\edge-devtools-network-console\packages\network-console-vscode-extension>npm i
tmp\edge-devtools-network-console\packages\network-console-vscode-extension>vsce package  # repro's here

To outline what goes on here: the first npm i installs the top-level script dependencies. SKIP_PREFLIGHT_CHECK is required to avoid a build problem with a create-react-app script conflict in devtools-network-frontend. npm run install-and-build then runs npm install in both network-console-shared and devtools-network-console, and compiles them. Finally, we create a symbolic link from the devtools-network-console project's build folder, runs npm i, then tries to run the package command.

@robpaveza
Copy link
Author

Note: I did see #207 and #52, but the proposed workarounds didn't seem to work for me.

@robpaveza
Copy link
Author

In fairness, this does seem to be an issue with NPM, not with VSCE; but I'm not sure why VSCE requires this information in the first place (or, perhaps more accurately, why an error caused by extraneous rises to termination of VSCE).

Here's an example of why this seems weird to me, running npm ll:

npm ERR! missing: @types/mocha@7.0.2, required by network-console-shared@0.9.1-preview
(others)
npm ERR! extraneous: @types/mocha@7.0.2 C:\Users\Work\tmp\edge-devtools-network-console\packages\network-console-vscode-extension\node_modules\network-console-shared\node_modules\@types\mocha

So, @types/mocha@7.0.2 is missing but it's also extraneous.

I have build a similar project in a similar directory structure. I don't understand the problem here.

@joaomoreno
Copy link
Member

joaomoreno commented Jul 30, 2020

but I'm not sure why VSCE requires this information in the first place

VSCE tries to filter out the devDependencies out of node_modules, such that they don't get included in the extension.

We could potentially figure out a --skip-dependency-check or similar and just have it include everything, if you know what you're doing, ie don't have any dev dependencies in node_modules.

@joaomoreno joaomoreno self-assigned this Jul 30, 2020
@joaomoreno joaomoreno added the bug Issue identified by VS Code Team member as probable bug label Jul 30, 2020
@joaomoreno
Copy link
Member

#203

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants