我知道这是节点安装的常见问题,其中节点未添加到环境路径。我已经证实了这一点。就业地点以某种方式将其锁定,我试图找出究竟会阻止它的原因。
我已成功安装节点,cmd行具有管理员权限但有限。所以我无法从命令行运行node / npm。所以,我一步成功地转移到Git Bash和PowerShell。为了限制Git Bash,我不得不手动添加npm包bower,pm2,mocha等到env。来自../User/../Roaming目录的路径。所以在bash我可以运行像npm -v,node -v,mocha等等。我甚至可以安装,npm install -g mocha。
当它变得棘手的时候我会进行npm测试(在package.json中配置了mocha)mocha启动但失败并告诉我节点不被识别为内部或外部......
有什么想法吗?
以下是我的配置文件:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Tests",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"${workspaceRoot}/test"
],
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}\\test.js"
}
]
}
{
"name": "test",
"version": "1.0.0",
"description": "test project to walkthrough Mocha",
"main": "test.js",
"scripts": {
"test": "mocha test"
},
"author": "some guy",
"license": "MIT",
"dependencies": {
"mocha": "^3.4.2"
}
}