试图在Mac上运行Gulp,但它不起作用

问题描述 投票:0回答:1

我正试图在我的Mac上运行Gulp。我进入终端并进入我的gulp文件夹。当我输入

gulp

我得到“-bash:gulp:command not found”。在我的gulp文件夹中,我在那里有一个gulpfile.js但是我什么都没得到。我从哪里开始?

这是我在npm install -g时得到的错误:

MacBook-Pro-2:gulp-dev damien$ npm install -g gulp
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "gulp"
npm ERR! node v7.8.0
npm ERR! npm  v4.2.0
npm ERR! path ../lib/node_modules/gulp/bin/gulp.js
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink

npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR!  { Error: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/gulp/bin/gulp.js',
npm ERR!   dest: '/usr/local/bin/gulp' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/damien/.npm/_logs/2017-04-11T20_42_46_317Z-debug.log
MacBook-Pro-2:gulp-dev damien$ npm install -g gulp
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "gulp"
npm ERR! node v7.8.0
npm ERR! npm  v4.2.0
npm ERR! path ../lib/node_modules/gulp/bin/gulp.js
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink

npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR!  { Error: EACCES: permission denied, symlink '../lib/node_modules/gulp/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/gulp/bin/gulp.js',
npm ERR!   dest: '/usr/local/bin/gulp' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/damien/.npm/_logs/2017-04-11T20_43_48_551Z-debug.log
gulp
1个回答
1
投票

你在机器上安装了Gulp吗?

如果您的文件夹中有package.json文件,请确保您在devDependencies之间列出了Gulp。这些依赖项是您在开发Node项目期间使用的依赖项。

如果您没有package.json文件,可以通过npm init在命令行中创建一个文件,然后使用npm install -g gulp在您的计算机上本地安装Gulp,然后在项目文件夹中安装gulp的命令行界面:npm install --save-dev gulp-cli。 CLI将使用项目中的Gulpfile.js运行Gulp可执行文件。

更多信息可以在他们的网站上找到:http://gulpjs.com/

© www.soinside.com 2019 - 2024. All rights reserved.