【问题标题】:Webstorm,nodejs, npm test, '.' is not recognized as an internal or external command,Webstorm,nodejs,npm 测试,“。”不被识别为内部或外部命令,
【发布时间】:2015-02-22 10:43:42
【问题描述】:

我是 nodejs 的新手,正在开发 Webstorm 9.0.1,我正在尝试使用 Lab 模块进行测试,使用本教程 https://medium.com/the-spumko-suite/testing-hapi-services-with-lab-96ac463c490a

我的 package.json 文件包含以下内容:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "./node_modules/lab/bin/lab -c"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "hapi": "^8.0.0",
    "joi": "^5.0.2",
    "lab": "^5.1.0"
  }
}

C:\Users\DT002\WebstormProjects\hapiB\test>目录下创建本地node_modules目录

问题是当我尝试测试时,出现以下错误:

> C:\Users\DT002\WebstormProjects\hapiB\test>npm test
> 
> test@1.0.0 test C:\Users\DT002\WebstormProjects\hapiB\test
> ./node_modules/lab/bin/lab -c

'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

感谢您的任何建议。

【问题讨论】:

标签: node.js testing npm webstorm


【解决方案1】:

脚本中的说明在终端中作为命令运行。你有你的npm test:"./node_modules/lab/bin/lab -c"

系统抱怨的是您那里的第一个点。您可以删除./,错误就会消失。

{ "test": "node_modules/lab/bin/lab -c" }

【讨论】:

  • 我试过了,但它给了我以下信息: C:\Users\DT002\WebstormProjects\hapiB\test>npm test > test@1.0.0 test C:\Users\DT002\WebstormProjects\hapiB \test > node_modules/lab/bin/lab -c 'node_modules' 不是内部或外部命令, 可运行程序或批处理文件。 npm 错误!测试失败。有关更多详细信息,请参见上文。 npm 错误!代码不正确 0
  • 既然是windows,你不需要让条指向左边吗? \ 而不是 / ?
猜你喜欢
  • 2018-10-19
  • 1970-01-01
  • 2018-07-13
  • 2019-02-02
  • 1970-01-01
  • 2017-02-03
  • 2019-06-28
  • 2016-11-29
  • 1970-01-01
相关资源
最近更新 更多