node.js - 不使用 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
推荐阅读
- discourse - 由于违反内容安全政策,discourse 电子邮件激活不再有效
- mysql - SQL 结果长度,搜索时不显示任何内容
- r - Lattice panel.abline 在数据点后面绘制线
- python - 如何构建一个函数来基于包含某个字符串的其他列创建一个新列?
- php - PHP 致命错误:尝试运行测试示例时找不到类“WP_UnitTestCase”
- c# - 从控制台应用程序使用 RestSharp 时收到的空白值
- ios - React Native iOS Build in Release 配置冻结在启动屏幕上
- python-3.x - GnuPG 已安装,但 python 在运行时找不到它
- java - sonarqube 中的包命名问题
- python - 拆分多页 tiff 并使用修改后的后缀递归保存每个 tiff