【问题标题】:`npm run gulp` can not find module 'gulp-shell'?`npm run gulp` 找不到模块 'gulp-shell'?
【发布时间】:2016-05-28 22:25:37
【问题描述】:

我已经删除了node modules 文件夹并使用npm install 命令安装了npm。我的gulpfile.js 也很完美,因为其他人都在完美地使用这个配置,即使我在另一台机器上使用这个配置也是如此。但是当我尝试从当前机器运行npm run gulp 时,它会显示以下错误。

Fahads-MacBook-Pro:dark-web jim$ npm run gulp

> jetaport@1.0.0 gulp /Users/jim/Documents/JETAPORT/dark-web
> gulp

module.js:327
    throw err;
    ^

Error: Cannot find module 'gulp-shell'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/jim/Documents/JETAPORT/dark-web/gulpfile.js:6:13)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "gulp"
npm ERR! node v4.4.2
npm ERR! npm  v2.15.0
npm ERR! code ELIFECYCLE
npm ERR! jetaport@1.0.0 gulp: `gulp`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the jetaport@1.0.0 gulp script 'gulp'.
npm ERR! This is most likely a problem with the jetaport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs jetaport
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls jetaport
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/jim/Documents/JETAPORT/dark-web/npm-debug.log

这是package.json 文件

{
  "name": "jetaport",
  "version": "1.0.0",
  "description": "The Jetaport Gulp dependencies.",
  "main": "index.js",
  "author": "Alexander Khost",
  "repository": {
    "type": "git",
    "url": "git://github.com/akhost/Jetaport.git"
  },
  "license": "ISC",
  "dependencies": {
    "autoprefixer": "^6.3.1",
    "babel-preset-es2015": "^6.3.13",
    "babel-preset-react": "^6.3.13",
    "bower": "^1.7.2",
    "gulp": "^3.9.0",
    "gulp-autoprefixer": "^3.1.0",
    "gulp-cssnano": "^2.0.0",
    "gulp-imagemin": "^2.4.0",
    "gulp-postcss": "^6.0.1",
    "imagemin-pngquant": "^4.2.0",
    "laravel-elixir": "^5.0.0",
    "pixrem": "^3.0.0",
    "postcss-conditionals": "^2.0.0",
    "postcss-each": "^0.9.1",
    "postcss-import": "^7.1.3",
    "postcss-math": "0.0.1",
    "postcss-mixins": "^4.0.1",
    "postcss-nested": "^1.0.0",
    "postcss-reporter": "^1.3.0",
    "postcss-scss": "^0.1.3",
    "postcss-simple-extend": "^1.0.0",
    "postcss-simple-vars": "^1.1.0",
    "precss": "^1.3.0",
    "yargs": "^4.4.0"
  },
  "bugs": {
    "url": "https://github.com/akhost/Jetaport/issues"
  },
  "homepage": "https://github.com/akhost/Jetaport#readme",
  "directories": {
    "test": "tests"
  },
  "devDependencnpm ies": {
    "gulp-notify": "^2.2.0"
  },
  "scripts": {
    "gulp": "gulp",
    "bower": "bower"
  },
  "devDependencies": {
    "gulp": "^3.9.1"
  }
}

【问题讨论】:

  • 发布你的 package.json
  • @MarkoGrešak 我已经添加了。请看一看。

标签: node.js macos command-line gulp gulp-shell


【解决方案1】:

您的package.json 缺少gulp-shell 包。你必须用npm install --save gulp-shell 安装它(或者--save-dev 如果你想把它放在devDependencies 下)。不知道其他人是如何让它工作的,但我很有信心他们自己安装了它,就像我建议的那样,没有保存标志,这就是 package.json 中缺少它的原因。

【讨论】:

  • 太棒了。 gulp-shell 不见了。我已经安装了 npm install --save-dev gulp-shell 。其背后的原因是我忘记从上游下载软件包的最新更新。谢谢大佬!
猜你喜欢
  • 2017-06-24
  • 1970-01-01
  • 1970-01-01
  • 2019-05-26
  • 2017-01-03
  • 2017-11-07
  • 2018-10-19
  • 1970-01-01
相关资源
最近更新 更多