简体   繁体   English

不使用 npm 就无法运行节点命令

[英]cannot run node command without using npm

I am working on a new node project in windows machine.我正在 windows 机器上开发一个新的节点项目。

In my package.json I've set test script:在我的package.json我设置了测试脚本:

"scripts": {
    "test": "cucumber-js test"
  },

If I run the command > npm run test it works properly, but if I run > cucumber-js test I get the following error:如果我运行命令> npm run test它可以正常工作,但是如果我运行> cucumber-js test我会收到以下错误:

cucumber-js : The term 'cucumber-js' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify 
that the path is correct and try again.
At line:1 char:1
+ cucumber-js test
+ ~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (cucumber-js:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Is there any explanation?有什么解释吗? How can I resolve it?我该如何解决?

As mentioned in the comments the problem is resolved by providing the exact path: .\node_modules\.bin\cucumber-js test如评论中所述,通过提供确切路径解决了问题: .\node_modules\.bin\cucumber-js test

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Node 和 npm 升级后无法运行任何 npm 命令 - Cannot run any npm command after Node and npm upgrade 如何使用“ nodemon”和简单的“ node”命令而不使用“ npm start”命令来运行Express的脚手架? - How to run express's scaffold using “nodemon” and simple “node” command, without using “npm start” command? 运行 npm 命令行而不将节点添加到路径 - Run npm command line without add node to path 如何在没有“run”的情况下运行“npm command”(即“npm command”而不是“npm run command”)? - How to run “npm command” run without “run” (i.e. “npm command” instead of “npm run command”)? 无法运行任何npm全局命令 - cannot run any npm global command 无法将命令“ webpack”替换为“ npm run build” - Cannot replace command 'webpack' by 'npm run build' node-sass 不使用 npm run css 命令编译 scss 文件 - node-sass does not compile scss file using npm run css command 如何使用nvm使用不同版本的节点运行npm命令? - How do I run an npm command with a different version of node using nvm? 使用 NVM 时找不到 NPM 和 NODE 命令 - NPM and NODE command not found when using NVM 节点:我可以从命令行运行全局模块/包而无需指定完整路径[Ubuntu,Nodejs,NPM] - Node: Can I run global modules/packages from command line without specifying full path [Ubuntu, Nodejs, NPM]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM