2017-04-11 25 views
0

我試圖在我的mac上運行gulp。我真的很陌生,對我這麼裸露的東西。我走進終端,進入我的大文件夾。當我鍵入試圖在mac上運行gulp,但它不工作

gulp 

我得到「-bash:gulp:command not found」。在我的gulp文件夾中,我確實有一個gulpfile.js,但又一次。沒有。我從哪裏出發?謝謝大家!

這裏是我得到的錯誤,當我NPM安裝-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 [email protected]^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 [email protected]^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 

回答

1

你有你的機器上安裝咕嘟咕嘟了嗎?

如果您的文件夾中有一個package.json文件,請確保您可以看到您的devDependencies之間列出的Gulp。這些依賴關係是您在開發Node項目期間使用的依賴關係。

如果沒有package.json文件,你可以在通過npm init從命令行創建一個,然後在本地機器上安裝npm install -g gulp咕嘟咕嘟,然後安裝了大口的命令行界面在項目文件夾:npm install --save-dev gulp-cli 。 CLI將運行您項目中的Gulpfile.js的Gulp可執行文件。

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

+0

我有一個的package.json文件。我從來沒有安裝過gulp,我不認爲,但是我只是運行了你的命令npm install -g gulp,並且我得到了一堆錯誤。我將編輯我的問題以顯示錯誤 – Damien

+0

另外,我嘗試在所有訪問權限設置父文件夾的權限,但這不起作用 – Damien

+0

是的,您似乎沒有權限這麼做。這意味着你必須使用'sudo'和'npm'命令,但這通常是不明智的。 多的人寫了一篇關於一個安全的方式這樣做: - https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md - https://johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/ - http://www.competa.com/blog/how-to-run-npm-without-sudo/ – Lodybo

相關問題