簡體   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