环境:
正如下图所示,在创建“Node.js速成应用程序”的面板上,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
选择最快的npm
镜像--淘宝,Webstorm
出错了。当更改回npm' main repository,
Webstormcan fetch
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
发布于 2015-07-06 01:50:20
最初,WebStorm在临时目录中安装指定版本的express-generator
包。然后,WebStorm使用它生成一个新的Express项目。WebStorm不使用已经安装的express
或express-generator
包。
顺便说一句,express-generator
总是在本地将express
包安装到一个新的项目中,所以已经安装的express
包无论如何都不能重用。
根据屏幕截图,问题是Version: Unavailable
(express-generator
的版本)。应该在对话框的底部,CSS
组合框下面指定原因。不确定,但可能是由于缺乏互联网连接所致。更详细的错误描述可以在idea.log中找到(在主菜单"Help \“中)。
发布于 2018-02-10 12:08:08
我在寻找解决办法时偶然发现了这个问题。我的错误是“package.json”文件中的语法错误。要么在主项目目录中,要么在Program中的节点安装。IDE没有标记错误,它只是声明它的“不可用”。
要解决此问题,请打开CMD -在节点分期付款文件夹中,删除package.json和node_modules文件夹。(确保备份了非缺省值,以便让它们返回),然后运行:
npm init
这将削弱npm,并恢复默认包和package.json。这将反过来恢复快车生成器。
https://stackoverflow.com/questions/31237338
复制相似问题