vscode-search-node-modules icon indicating copy to clipboard operation
vscode-search-node-modules copied to clipboard

How to search node modules in one step back parent folder

Open SaranSank opened this issue 5 years ago • 11 comments

Hi, Currently we can search only node modules in workspaceFolder but how we can search in parent folder..where i want to change in extension.js? My project folder structure :

http://localhost/projects/mynodemodules/myproject

mynodemodules->folder [ http://localhost/projects/mynodemodules/ ]

  • node_modules myproject->folder [ http://localhost/projects/mynodemodules/myproject ] -index.html -text.js -style.css

SaranSank avatar Jul 29 '19 17:07 SaranSank

I am facing a similar issue.

I have the following structure ⸺

- root/
     - project/
         - index.js
         - package.json
         - node_modules
     - README.md

I have opened root/ folder in VSCode & I entered Search node_modules in search. It threw an error Search node_modules: No node_modules folder in this workspace.

Any ideas to solve this?

deadcoder0904 avatar Aug 07 '19 13:08 deadcoder0904

@deadcoder0904 : We can resolve easy,

getWorkspaceFolder().then(folder => folder && getProjectFolder(folder)).then(folder => { if (folder) { var f_path = path.join(folder.path, '../'); searchPath(folder.name, f_path, modulesPath); } });

SaranSank avatar Aug 15 '19 08:08 SaranSank

@SaranSank PR might be more helpful :)

deadcoder0904 avatar Aug 15 '19 08:08 deadcoder0904

@deadcoder0904 : You are from india? You well in nodejs?

SaranSank avatar Aug 22 '19 19:08 SaranSank

Yeah

deadcoder0904 avatar Aug 23 '19 04:08 deadcoder0904

I have one doubt in nodjs. How to read dir from server path. Example

var f_path = "http://hostname.com/ac/projects/nodepackages"; searchPath(folder.name, f_path, modulesPath);

SaranSank avatar Aug 23 '19 04:08 SaranSank

You should ask such questions on StackOverflow. Never spam an issue.

But to answer your question, that is not the correct way unless your host is publicly accessible. Do it just as you do locally & then push to server & it should work.

deadcoder0904 avatar Aug 23 '19 05:08 deadcoder0904

I did in locally.But not working for server url. I have asked in stackOverflow but no answer

SaranSank avatar Aug 23 '19 05:08 SaranSank

Try posting on reddit.com/r/nodejs

deadcoder0904 avatar Aug 23 '19 05:08 deadcoder0904

If you do not mind can you send me ur email id or any other mode to contact. That is very usefull to contact you. Here we can not discuss more

SaranSank avatar Aug 23 '19 05:08 SaranSank

@deadcoder0904 : Are you there?

SaranSank avatar Aug 23 '19 06:08 SaranSank