question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Npm Scripts view not available if package.json located only in nested folder

See original GitHub issue

Issue Type: Bug

Noticed that in project where there is no package.json file in root folder I cannot show Npm Scripts view (even from context menu on other views in explorer folder. Structure

project-folder
|--backend1
|--backend2
|--static
\--ui
   |--src (contains app source)
   |--tools
   |  |--tool1
   |  |  \--package.json
   |  |
   |  \--tool2
   |     \--package.json
   |
   \--pacakge.json (main)

In this case unless I open any of 3 package.json files (in ui, ui/tools/tool1, and ui/tools/tool2) it’s not possible to get that view, see tasks an run them. I also haven’t found any command to force Npm Scripts visibility.

However as soon as I open any of them - I can see view with all 3 package.json files and their tasks in it.

UPD. Removed wrong code pointers and assumptions.

Tried with default value of npm.autoDetect and explicitly putting "npm.autoDetect": "on" in User and Workspace settings.

VS Code version: Code - Insiders 1.55.0-insider (6f726bcdf6a4d6cb518a3fcdb03c21be7293f417, 2021-03-25T08:19:33.237Z) OS version: Windows_NT x64 10.0.19041

System Info
Item Value
CPUs Intel® Core™ i7-8700 CPU @ 3.20GHz (12 x 3192)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: enabled
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.72GB (19.75GB free)
Process Argv –crash-reporter-id cf52dbde-2c94-45c3-9bf3-45d8b9966b04
Screen Reader no
VM 0%
Extensions: none

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:28
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
q00ucommented, Apr 2, 2021

Did this change recently? I could previously see my npm scripts, even though the package.json was one folder deep. Until I updated today, that is.

5reactions
alexr00commented, Mar 25, 2021

Certainly, that’s a reasonable feature request!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can NPM scripts use my current working directory (when ...
If I run npm run pwd within a subfolder of the project root (e.g, $PROJECT_ROOT/src/nested/dir ), instead of printing out my current path...
Read more >
package.json - npm Docs
Description. This document is all you need to know about what's required in your package.json file. It must be actual JSON, not just...
Read more >
folders - npm Docs
git-folder seeking logic when running git commands in a working dir.) If no package root is found, then the current folder is used....
Read more >
run-z - npm
json is a script executable by a package manager (NPM or Yarn). If executed script is a run-z command, the latter treats every...
Read more >
npm-pack
Create a tarball from a package. ... Whether or not to output JSON data, rather than the normal output. In npm pkg set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found