加域后的一点问题。

电脑公司加域后很纠结,不论如何安装gulp,都提示不存在这个命令等等,按照经验的反应,就是环境变量问题,在网上搜了好久,各种办法都不行。

很多人会说让你 在系统变量中新增 NODE_PATH:%AppData%\npm\node_modules
but it does’t work at all!!!and fuck baidu,so I went to google、 stackoverflow and so on to find the answer,however,I found this page :
stackoverflow and this answer:

“I was having the same problem when trying to get gulp working on a co-workers VM. It seems the problem stems from the users folder.

Adding NODE_PATH in my environment variables didn’t fix the problem.

If you edit your ‘Path’ variable in your system variables and add ‘%APPDATA%\npm’ at the end of that, it should fix the problem… Unless you or somebody else npm installed gulp as another user than the one you’re currently logged in as.

If you want it to be available for all users, put ‘C:\Users\yourUser\AppData\Roaming\npm'(or where ever you have gulp) explicitly instead of using ‘%APPDATA%\npm’. You can also move the files to a more user-indifferent path.

Don’t forget to start a new cmd prompt, because the one you have open won’t get the new ‘Path’ variable automatically.

Now ‘gulp’.”

seems to be like my condition,因为公司加域,所以我的用户等于也切换了。npm之前的安装是给另外一个用户的,所以 我们在添加环境变量时候,直接在path中增加 指向到npm的那个环境变量就好,比如 文中的 :’C:\Users\yourUser\AppData\Roaming\npm’ 这个路径,youUser就是我们的管理员用户名。然后重新启动cmd,然后一切正常。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据