首页 > 解决方案 > 'node_modules' 不是内部或外部命令、可运行程序或批处理文件

问题描述

我在我的应用程序中使用 gulp。

  1. 安装一口
  2. 把 npm 脚本
  3. 使用“npm start”运行脚本

得到错误:- **> 开始

node_modules/.bin/gulp watch 'node_modules' 不是内部或外部命令、可运行程序或批处理文件。**

在 package.json 中启动脚本:- "scripts": { "start": "node_modules/.bin/gulp watch" },

请帮我解决这个问题。谢谢

标签: javascriptnode.jsnpmgulpgulp-watch

解决方案


使用 npm 包时,您不需要在 node_modules 中指定可执行文件的路径。尝试以下设置:

  "scripts": {
    "start": "gulp watch"
  },

确保 gulp 也存在于依赖项中。

  "dependencies": {
    "gulp": "^4.0.2"
  }

推荐阅读