草庐IT

node.js - Webstorm 无法在 Windows 和 Ubuntu 上识别 Node Express

coder 2024-06-17 原文

环境:

  • Webstorm v10.0.4
  • Node.js v0.12.5
  • Windows 8.1
  • Ubuntu 14.04

如下图,在创建'Node.js Express App'的面板上,Webstorm只找到了Nodenpm,但是无法识别 express 。 当然 Express 是全局安装的,我可以在终端上通过 express-generator 创建一个 Express 项目。

➜  ~  npm -g list -depth=0
/usr/local/lib
├── bower@1.4.1
├── cheerio@0.19.0
├── express@4.13.0
├── express-generator@4.12.4
├── npm@2.11.2
└── nrm@0.2.5

idea.log如下,不是详细消息:

[      0]   INFO -        #com.intellij.idea.Main - ------------------------------------------------------ IDE STARTED ------------------------------------------------------ 
[     93]   INFO -        #com.intellij.idea.Main - IDE: WebStorm (build #WS-141.1550, 12 Jun 2015 00:00) 
[     93]   INFO -        #com.intellij.idea.Main - OS: Windows 8 (6.2, x86) 
[     93]   INFO -        #com.intellij.idea.Main - JRE: 1.8.0_40-b26 (Oracle Corporation) 
[     93]   INFO -        #com.intellij.idea.Main - JVM: 25.40-b25 (Java HotSpot(TM) Server VM) 
[    109]   INFO -        #com.intellij.idea.Main - JVM Args: -Xms128m -Xmx512m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=150m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djb.vmOptions=D:\WebStorm 10.0.4\bin\WebStorm.exe.vmoptions -Xbootclasspath/a:D:\WebStorm 10.0.4\lib\boot.jar -Didea.platform.prefix=WebStorm -Didea.no.jre.check=true -Didea.paths.selector=WebStorm10 
[    281]   INFO -        #com.intellij.idea.Main - JNA library loaded (32-bit) in 172 ms 
[    296]   INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational 
[    328]   INFO -        #com.intellij.idea.Main - Using "FocusKiller" library to prevent focus stealing. 
[   1920]   INFO - llij.ide.plugins.PluginManager - Cannot find optional descriptor js-nashorn-support.xml 
[   3094]   INFO - llij.ide.plugins.PluginManager - 48 plugins initialized in 1909 ms 
[   3110]   INFO - llij.ide.plugins.PluginManager - Loaded bundled plugins: ASP (0.1), AngularJS (141.1550), CSS Support, CVS Integration (11), CoffeeScript (2.0), Cucumber.js (141.1550), Dart (141.1550), EJS (141.1550), EditorConfig (1.0), File Watchers (141.1550), Gherkin (999.999), Git Integration (8.1), GitHub, HAML, HTML Tools (2.0), Handlebars/Mustache (141.1550), IDEA CORE, IntelliLang (8.0), JSTestDriver Plugin (141.1550), Jade (141.1550), Java Server Pages Integration (1.0), JavaScript Debugger (1.0), JavaScript Intention Power Pack (0.9.4), JavaScript Support (1.0), Karma (141.1550), LESS support, LiveEdit (999.0), Meteor (141.1550), NodeJS (141.1550), Perforce Integration (2.0), PhoneGap/Cordova Plugin (141.1550), Polymer & Web Components (141.1550), QuirksMode, REST Client, Refactor-X (2.01), Remote Hosts Access (0.1), SASS support, Spy-js (141.1550), Stylus support (141.1550), Subversion Integration (1.1), Task Management (1.0), Terminal (0.1), TextMate bundles support (VERSION), W3C Validators (2.0), XPathView + XSLT Support (4), XSLT-Debugger (1.4), YAML, hg4idea (10.0) 
[   4391]   INFO - ellij.util.io.PagedFileStorage - lower=100; upper=200; buffer=10; max=498008064 
[   4469]   INFO - api.vfs.impl.local.FileWatcher - Starting file watcher: D:\WebStorm 10.0.4\bin\fsnotifier.exe 
[   4516]   INFO - api.vfs.impl.local.FileWatcher - Native file watcher is operational. 
[   5474]   INFO - lij.diagnostic.DebugLogManager - Set DEBUG for the following categories: [] 
[   6709]   INFO - rains.ide.BuiltInServerManager - built-in server started, port 63343 
[   8931]   INFO - pl.stores.ApplicationStoreImpl - 77 application components initialized in 5758 ms 
[   8965]   INFO - .intellij.idea.IdeaApplication - App initialization took 10956 ms 
[   9614]   INFO - ellij.project.impl.ProjectImpl - 16 project components initialized in 258 ms 
[   9614]   INFO - le.impl.ModuleManagerComponent - 0 module(s) loaded in 0 ms 
[  17941]   INFO - odejs.packages.NodePackageUtil - Loading node package info for express-generator ... 
[  20427]   INFO - odejs.packages.NodePackageUtil - Info for express-generator node package loaded successfully in 2478.9 ms 
[  21655]   INFO - odejs.packages.NodePackageUtil - Loading node package info for express-generator ... 
[  22243]   INFO - odejs.packages.NodePackageUtil - Info for express-generator node package loaded successfully in 577.0 ms 

这个问题在 Ubuntu 和 Windows 上都会出现。
感谢您的帮助!


更新:
如下图,我用nrm选择最快的npm镜像——淘宝,Webstorm就出错了。当改回 npm 的主存储库时,Webstorm可以获取express-generator` 信息,一切正常。奇怪!

C:\Users\honghe>nrm ls

  npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
* taobao - http://registry.npm.taobao.org/
  edunpm - http://registry.enpmjs.org/
  eu ----- http://registry.npmjs.eu/
  au ----- http://registry.npmjs.org.au/
  sl ----- http://npm.strongloop.com/
  nj ----- https://registry.nodejitsu.com/
  pt ----- http://registry.npmjs.pt/


C:\Users\honghe>nrm test

  npm ---- 1646ms
  cnpm --- 1275ms
* taobao - 4388ms
  edunpm - 994ms
  eu ----- 2422ms
  au ----- 1040ms
  sl ----- 1369ms
  nj ----- 2176ms
  pt ----- Fetch Error

最佳答案

最初,WebStorm 在临时目录中安装指定版本的 express-generator 包。然后 WebStorm 使用它来生成一个新的 Express 项目。 WebStorm 不使用已安装的 expressexpress-generator 包。

顺便说一句,express-generator 总是在本地将 express 包安装到新项目中,所以已经安装的 express 包无论如何都不能重复使用。

根据截图,问题出在Version: Unavailable(express-generator的版本)。应在对话框底部的 CSS 组合框下方指定原因。不确定,但可能是由于缺少 Internet 连接造成的。更详细的错误描述可以在 idea.log 中找到(在主菜单“帮助 | 在资源管理器中显示日志”)。

关于node.js - Webstorm 无法在 Windows 和 Ubuntu 上识别 Node Express,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31237338/

有关node.js - Webstorm 无法在 Windows 和 Ubuntu 上识别 Node Express的更多相关文章

  1. ruby - 在 Ruby 程序执行时阻止 Windows 7 PC 进入休眠状态 - 2

    我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0

  2. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  3. ruby-on-rails - 无法使用 Rails 3.2 创建插件? - 2

    我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby​​1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在

  4. ruby - 无法运行 Rails 2.x 应用程序 - 2

    我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby​​:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r

  5. ruby-on-rails - 无法在centos上安装therubyracer(V8和GCC出错) - 2

    我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e

  6. ruby - 无法让 RSpec 工作—— 'require' : cannot load such file - 2

    我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳

  7. ruby - 无法覆盖 irb 中的 to_s - 2

    我在pry中定义了一个函数:to_s,但我无法调用它。这个方法去哪里了,怎么调用?pry(main)>defto_spry(main)*'hello'pry(main)*endpry(main)>to_s=>"main"我的ruby版本是2.1.2看了一些答案和搜索后,我认为我得到了正确的答案:这个方法用在什么地方?在irb或pry中定义方法时,会转到Object.instance_methods[1]pry(main)>defto_s[1]pry(main)*'hello'[1]pry(main)*end=>:to_s[2]pry(main)>defhello[2]pry(main)

  8. ruby - 无法在 60 秒内获得稳定的 Firefox 连接 (127.0.0.1 :7055) - 2

    我使用的是Firefox版本36.0.1和Selenium-Webdrivergem版本2.45.0。我能够创建Firefox实例,但无法使用脚本继续进行进一步的操作无法在60秒内获得稳定的Firefox连接(127.0.0.1:7055)错误。有人能帮帮我吗? 最佳答案 我遇到了同样的问题。降级到firefoxv33后一切正常。您可以找到旧版本here 关于ruby-无法在60秒内获得稳定的Firefox连接(127.0.0.1:7055),我们在StackOverflow上找到一个类

  9. ruby - 安装 Ruby 时遇到问题(无法下载资源 "readline--patch") - 2

    当我尝试安装Ruby时遇到此错误。我试过查看this和this但无济于事➜~brewinstallrubyWarning:YouareusingOSX10.12.Wedonotprovidesupportforthispre-releaseversion.Youmayencounterbuildfailuresorotherbreakages.Pleasecreatepull-requestsinsteadoffilingissues.==>Installingdependenciesforruby:readline,libyaml,makedepend==>Installingrub

  10. ruby - 如何在 Ubuntu 中清除 Ruby Phusion Passenger 的缓存? - 2

    我试过重新启动apache,缓存的页面仍然出现,所以一定有一个文件夹在某个地方。我没有“公共(public)/缓存”,那么我还应该查看哪些其他地方?是否有一个URL标志也可以触发此效果? 最佳答案 您需要触摸一个文件才能清除phusion,例如:touch/webapps/mycook/tmp/restart.txt参见docs 关于ruby-如何在Ubuntu中清除RubyPhusionPassenger的缓存?,我们在StackOverflow上找到一个类似的问题:

随机推荐