简体   繁体   English

MAC OS X Yosemite 10.10.5 上的 npm、node-gyp 和 gulp 问题

[英]Problems with npm, node-gyp and gulp on MAC OS X Yosemite 10.10.5

I've problems with installing npm , node-gyp and gulp on my MAC.我在 MAC 上安装npmnode-gyp和 gulp 时遇到问题。 I need this for a Laravel project.我需要这个用于Laravel项目。 I did my research throughout the internet but I could not find a solution which was working for me.我在整个互联网上进行了研究,但找不到适合我的解决方案。 It seems like something goes wrong with the paths.似乎路径出了问题。

I've tried:我试过了:

  • installing node/npm through the website nodejs.org and this seems to install fine.通过网站nodejs.org安装 node/npm,这似乎安装得很好。 After trying with node -v and npm -v everything was accessible globally.尝试使用node -vnpm -v一切都可以全局访问。
  • installing npm via homebrew .通过homebrew安装 npm。 Works also but doesn't install all the dependencies.也可以工作,但不会安装所有依赖项。

When it comes to install gulp and node-gyp everything goes wrong.在安装gulpnode-gyp 时,一切都出错了。 I tried with npm install -g gulp but I could not access the application file nor globally or through the install path.我尝试使用npm install -g gulp但我无法访问应用程序文件,也无法全局访问或通过安装路径访问。

If you need more info let me know!如果您需要更多信息,请告诉我!

Thank you so much for your help!非常感谢你的帮助!

UPDATE更新

I've followed this instructions here .我已按照此处的说明进行操作。 Everything works fine until I get to the point where I have to install npm manually through curl -L http://npmjs.org/install.sh | sh一切正常,直到我必须通过curl -L http://npmjs.org/install.sh | sh手动安装 npm curl -L http://npmjs.org/install.sh | sh curl -L http://npmjs.org/install.sh | sh . curl -L http://npmjs.org/install.sh | sh I get an error message that the SSL certificate is not verificated.我收到一条错误消息,指出未验证 SSL 证书。 Trying with -k gives me an error that the file could not be found.尝试使用-k会给我一个错误,即找不到文件。 I've also tried to download the shell script and run it manually from the terminal.我还尝试下载 shell 脚本并从终端手动运行它。 In that case it seems to do something but again it causes an issue with the SSL certificates.在这种情况下,它似乎做了一些事情,但又会导致 SSL 证书出现问题。

To install gulp you need to use sudo as the -g flag tries to install the package to /usr/local/lib/node_modules/ .要安装 gulp,您需要使用sudo作为-g标志尝试将软件包安装到/usr/local/lib/node_modules/

Either do sudo npm install -g gulp or change the permissions of /usr/local/ so that your user or a group its in has write access.要么执行sudo npm install -g gulp要么更改/usr/local/的权限,以便您的用户或其所在的组具有写入权限。

I finally found the solution.我终于找到了解决方案。 Installing via homebrew seems to make the least bit of problems.通过自制软件安装似乎不会造成任何问题。 It does install everything well but as stated in the link from my original post, it does mess up the paths.它确实安装了所有东西,但正如我原来帖子中的链接所述,它确实弄乱了路径。 In case someone needs additional packages (node-gyp, gulp), it will have to be installed via sudo npm -g yourpackagehere .如果有人需要其他软件包(node- sudo npm -g yourpackagehere ),则必须通过sudo npm -g yourpackagehere安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM