繁体   English   中英

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

[英]cannot run node command without using npm

我正在 windows 机器上开发一个新的节点项目。

在我的package.json我设置了测试脚本:

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

如果我运行命令> 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

有什么解释吗? 我该如何解决?

如评论中所述,通过提供确切路径解决了问题: .\node_modules\.bin\cucumber-js test

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM