Webstorm 无法在 Windows 和 Ubuntu 上识别节点 Express
Webstorm cannot recognize node Express both on Windows and Ubuntu
环境:
- Webstorm v10.0.4
- Node.js v0.12.5
- Windows 8.1
- Ubuntu 14.04
如下图所示,在创建'Node.js Express App'的面板上,Webstorm只找到Node
和npm
,无法识别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
到select最快的npm
镜像——淘宝,Webstorm
就出问题了。当改回 npm' main repository,
Webstormcan fetch
express-generator` info 时,一切正常。奇怪!
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 不使用已安装的 express
或 express-generator
包。
顺便说一句,express-generator
总是在本地将 express
包安装到新项目中,因此已经安装的 express
包无论如何都不能重复使用。
根据截图,问题出在Version: Unavailable
(express-generator
的版本)。应在对话框底部的 CSS
组合框下方指定原因。不确定,但可能是由于缺少 Internet 连接造成的。可以在 idea.log(在主菜单 "Help | Show Log in Explorer" 上)中找到更详细的错误描述。
我在寻找解决方案时偶然发现了这个问题。我的是 'package.json' 文件中的语法错误。在主项目目录或 Program Files 中的节点安装中。 IDE 没有标记错误,它只是声明它的 'Unavailible'.
要解决此问题,请执行以下操作,打开 CMD - 在节点安装文件夹中,删除 package.json 和 node_modules 文件夹。 (确保备份非默认的,以便您可以取回它们)然后运行:
npm init
这将初始化 npm 并恢复默认包和 package.json。这将反过来恢复 express-generator。
环境:
- Webstorm v10.0.4
- Node.js v0.12.5
- Windows 8.1
- Ubuntu 14.04
如下图所示,在创建'Node.js Express App'的面板上,Webstorm只找到Node
和npm
,无法识别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
到select最快的npm
镜像——淘宝,Webstorm
就出问题了。当改回 npm' main repository,
Webstormcan fetch
express-generator` info 时,一切正常。奇怪!
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 不使用已安装的 express
或 express-generator
包。
顺便说一句,express-generator
总是在本地将 express
包安装到新项目中,因此已经安装的 express
包无论如何都不能重复使用。
根据截图,问题出在Version: Unavailable
(express-generator
的版本)。应在对话框底部的 CSS
组合框下方指定原因。不确定,但可能是由于缺少 Internet 连接造成的。可以在 idea.log(在主菜单 "Help | Show Log in Explorer" 上)中找到更详细的错误描述。
我在寻找解决方案时偶然发现了这个问题。我的是 'package.json' 文件中的语法错误。在主项目目录或 Program Files 中的节点安装中。 IDE 没有标记错误,它只是声明它的 'Unavailible'.
要解决此问题,请执行以下操作,打开 CMD - 在节点安装文件夹中,删除 package.json 和 node_modules 文件夹。 (确保备份非默认的,以便您可以取回它们)然后运行:
npm init
这将初始化 npm 并恢复默认包和 package.json。这将反过来恢复 express-generator。