Gulp无法找到模块错误

时间:2018-12-30 20:35:30

标签: gulp gulp-sass macos-mojave

pacakge.json: 

"name": "cise",
  "version": "0.0.1",
  "description": "Accessible WordPress theme utilizing flex layouts and modern development practices.",
  "main": "index.php",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Imaginatii",
  "license": "GPL-3.0",
  "bugs": {
    "url": "imaginatii.com"
  },
  "homepage": "imaginatii.com",
  "devDependencies": {
    "autoprefixer": "^6.5.2",
    "browser-sync": "^2.17.6",
    "gulp": "^4.0.0",
    "gulp-image": "^4.4.1",
    "gulp-jshint": "^2.0.2",
    "gulp-newer": "^1.3.0",
    "gulp-postcss": "^8.0.0",
    "gulp-sass": "^2.3.2",
    "gulp-sourcemaps": "^2.2.0",
    "jshint": "^2.9.4"
  },
  "dependencies": {
    "runtask": "^1.0.0"
  }
}

发出gulp命令时,我不断收到错误消息“找不到模块”。当我执行npm install module-name时,似乎要清除掉gulp,我必须重新安装,所以我陷入了循环。我对节点不了解,可以将其用于Wordpress主题开发。

一切正常,直到我升级到macOS Mojave。

sh-3.2# npm install gulp

> fsevents@1.2.4 install /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/fsevents
> node install

[fsevents] Success: "/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> node-sass@3.13.1 install /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass
> node scripts/install.js

Unable to save binary /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass/vendor/darwin-x64-64 : { Error: EACCES: permission denied, mkdir '/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass/vendor'
    at Object.mkdirSync (fs.js:753:3)
    at sync (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/mkdirp/index.js:71:13)
    at Function.sync (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/mkdirp/index.js:77:24)
    at checkAndDownloadBinary (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass/scripts/install.js:111:11)
    at Object.<anonymous> (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass/scripts/install.js:154:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
  errno: -13,
  syscall: 'mkdir',
  code: 'EACCES',
  path:
   '/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass/vendor' }

> node-sass@3.13.1 postinstall /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass
> node scripts/build.js

Building: /usr/local/bin/node /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/bin/node',
gyp verb cli   '/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.8.0
gyp info using node@10.15.0 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:154:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:154:21)
gyp verb `which` failed   stack:
gyp verb `which` failed    'Error: not found: python2\n    at getNotFoundError (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:13:12)\n    at F (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:68:19)\n    at E (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:80:29)\n    at /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/which/which.js:89:16\n    at /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/isexe/index.js:42:5\n    at /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/isexe/mode.js:8:5\n    at FSReqWrap.oncomplete (fs.js:154:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python /usr/bin/python
gyp verb check python version `/usr/bin/python -c "import sys; print "2.7.10
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 10.15.0
gyp verb command install [ '10.15.0' ]
gyp verb install input version string "10.15.0"
gyp verb install installing version: 10.15.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp WARN EACCES user "root" does not have permission to access the dev dir "/var/root/.node-gyp/10.15.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass/.node-gyp"
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '--node_gyp_internal_noretry', '10.15.0' ]
gyp verb install input version string "10.15.0"
gyp verb install installing version: 10.15.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 10.15.0
gyp verb ensuring nodedir is created /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass/.node-gyp/10.15.0
gyp WARN install got an error, rolling back install
gyp verb command remove [ '10.15.0' ]
gyp verb remove using node-gyp dir: /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass/.node-gyp
gyp verb remove removing target version: 10.15.0
gyp verb remove removing development files for version: 10.15.0
gyp WARN install got an error, rolling back install
gyp verb command remove [ '10.15.0' ]
gyp verb remove using node-gyp dir: /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass/.node-gyp
gyp verb remove removing target version: 10.15.0
gyp verb remove removing development files for version: 10.15.0
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass/.node-gyp'
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/bin/node" "/Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/steph/Sites/cise/wp-content/themes/gulp-dev/node_modules/node-sass
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm WARN cise@0.0.1 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@3.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/root/.npm/_logs/2018-12-30T20_23_50_080Z-debug.log
sh-3.2# gulp
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module 'gulp-image'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/steph/Sites/cise/wp-content/themes/gulp-dev/gulpfile.js:7:10)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
sh-3.2# 

0 个答案:

没有答案