admin管理员组文章数量:1429455
Whenever I try to run a JavaScript or Python file in VS Code this error message appears:
I have tried reinstalling node but it still wont work. When I click on configure I am shown these options. When I click on any of them I am directed to this json file. I am pretty new to coding so sorry if I missed anything. Let me know if I did, I would be happy to provide it.
PS: I see that my interpreter at the bottom left is set to python, but clicking on it I am not getting any options that make sense to me. And also, this same thing happens when I try to run a python file.
Whenever I try to run a JavaScript or Python file in VS Code this error message appears:
I have tried reinstalling node but it still wont work. When I click on configure I am shown these options. When I click on any of them I am directed to this json file. I am pretty new to coding so sorry if I missed anything. Let me know if I did, I would be happy to provide it.
PS: I see that my interpreter at the bottom left is set to python, but clicking on it I am not getting any options that make sense to me. And also, this same thing happens when I try to run a python file.
Share Improve this question asked Jun 23, 2020 at 18:23 FourierDecepticonFourierDecepticon 211 silver badge2 bronze badges 1- How did you do to run the Javascript file? Did you use any mand? – Willian Commented Jun 23, 2020 at 19:32
3 Answers
Reset to default 2if you want to run npm mands you should go to a directory that your nodejs is installed... if you want to run npm mands in other directories you should go to the directory that you want and then run cmd and type in the mant
set path=C:\Program Files\nodejs\
then you can run all of the npm mands in your directory
In my case I didn't open the right directory (I was inside the project parent directory). Maybe it would help someone else who get into
The list of mands you see in there are what is called VS Code tasks, see details here - https://code.visualstudio./docs/editor/tasks
In your particular case they have been created to run npm
mands from within VS Code without opening the terminal. These require a package.json
file at the root of your project directory with corresponding script mands.
An example package.json
file might look something like this:
{
"scripts": {
"install": "npm install",
"test": "node test.js",
"start": "node index.js"
}
}
WARNING: your project should have a package.json
file with scripts that match what has been specified in your tasks.json
file.
Please provide a working copy of you application somewhere online, e.g. CodeSandbox, if you require more help.
本文标签: javascriptquotCould not find task 39npm39quot error in VS CodeStack Overflow
版权声明:本文标题:javascript - "Could not find task 'npm'" error in VS Code - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745491998a2660642.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论