npm start:启动脚本'ng serve'失败(npm start : Failed start script 'ng serve')
只是为了澄清这一点: 我对AngularJS和任何Web技术都是新手 。 在Web开发方面,我是初学者。
我试图安装它并且我必须承认,在许多“ 未知按钮按压 ”之后,我可能已经做了很大的混乱,或者可能没有。
我按照AngularJS网站的教程安装Angular,然后我只想推送“红色按钮”:
npm start
但它提出了一个错误说:
这里的实际Debug_Log:
0 info it worked if it ends with ok 1 verbose cli [ '/home/apanpie/.nvm/versions/node/v7.4.0/bin/node', 1 verbose cli '/home/apanpie/.nvm/versions/node/v7.4.0/bin/npm', 1 verbose cli 'start' ] 2 info using npm@4.0.5 3 info using node@v7.4.0 4 verbose config Skipping project config: /home/apanpie/.npmrc. (matches userconfig) 5 verbose run-script [ 'prestart', 'start', 'poststart' ] 6 info lifecycle apanpie@0.0.0~prestart: apanpie@0.0.0 7 silly lifecycle apanpie@0.0.0~prestart: no script for prestart, continuing 8 info lifecycle apanpie@0.0.0~start: apanpie@0.0.0 9 verbose lifecycle apanpie@0.0.0~start: unsafe-perm in lifecycle true 10 verbose lifecycle apanpie@0.0.0~start: PATH: /home/apanpie/.nvm/versions/node/v7.4.0/lib/node_modules/npm/bin/node-gyp-bin:/home/apanpie/node_modules/.bin:/home/apanpie/.nvm/versions/node/v7.4.0/bin:/home/apanpie/bin:/home/apanpie/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin 11 verbose lifecycle apanpie@0.0.0~start: CWD: /home/apanpie 12 silly lifecycle apanpie@0.0.0~start: Args: [ '-c', 'ng serve' ] 13 silly lifecycle apanpie@0.0.0~start: Returned: code: 1 signal: null 14 info lifecycle apanpie@0.0.0~start: Failed to exec start script 15 verbose stack Error: apanpie@0.0.0 start: `ng serve` 15 verbose stack Exit status 1 15 verbose stack at EventEmitter.<anonymous> (/home/apanpie/.nvm/versions/node/v7.4.0/lib/node_modules/npm/lib/utils/lifecycle.js:279:16) 15 verbose stack at emitTwo (events.js:106:13) 15 verbose stack at EventEmitter.emit (events.js:191:7) 15 verbose stack at ChildProcess.<anonymous> (/home/apanpie/.nvm/versions/node/v7.4.0/lib/node_modules/npm/lib/utils/spawn.js:40:14) 15 verbose stack at emitTwo (events.js:106:13) 15 verbose stack at ChildProcess.emit (events.js:191:7) 15 verbose stack at maybeClose (internal/child_process.js:885:16) 15 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 16 verbose pkgid apanpie@0.0.0 17 verbose cwd /home/apanpie/Desktop/angularTest 18 error Linux 4.4.0-59-generic 19 error argv "/home/apanpie/.nvm/versions/node/v7.4.0/bin/node" "/home/apanpie/.nvm/versions/node/v7.4.0/bin/npm" "start" 20 error node v7.4.0 21 error npm v4.0.5 22 error code ELIFECYCLE 23 error apanpie@0.0.0 start: `ng serve` 23 error Exit status 1 24 error Failed at the apanpie@0.0.0 start script 'ng serve'. 24 error Make sure you have the latest version of node.js and npm installed. 24 error If you do, this is most likely a problem with the apanpie package, 24 error not with npm itself. 24 error Tell the author that this fails on your system: 24 error ng serve 24 error You can get information on how to open an issue for this project with: 24 error npm bugs apanpie 24 error Or if that isn't available, you can get their info via: 24 error npm owner ls apanpie 24 error There is likely additional logging output above. 25 verbose exit [ 1, true ]
所以我搜遍了Google Globe,但一无所获。
另外,我不知道这是否相关,但在我的TypeScript代码中:
import { View, Component } from '@angular2/core'; [... Components Here ... ]
它会抛出一个错误:
Cannot find module '@angular2/core'
如果有人能够启发我,那会让我很开心!
Just to clarify this: I'm completely new to AngularJS and to any Web Technology. I'm a beginner when it comes to Web Development.
I tried to install it and I've gotta admit, after many "Unknown Buttons Pressings", I may have done a big mess, or maybe not.
I followed AngularJS Website's Tutorial to install Angular and then I just wanted to push the "Red Button":
npm start
But it threw an error saying:
Actual Debug_Log here:
0 info it worked if it ends with ok 1 verbose cli [ '/home/apanpie/.nvm/versions/node/v7.4.0/bin/node', 1 verbose cli '/home/apanpie/.nvm/versions/node/v7.4.0/bin/npm', 1 verbose cli 'start' ] 2 info using npm@4.0.5 3 info using node@v7.4.0 4 verbose config Skipping project config: /home/apanpie/.npmrc. (matches userconfig) 5 verbose run-script [ 'prestart', 'start', 'poststart' ] 6 info lifecycle apanpie@0.0.0~prestart: apanpie@0.0.0 7 silly lifecycle apanpie@0.0.0~prestart: no script for prestart, continuing 8 info lifecycle apanpie@0.0.0~start: apanpie@0.0.0 9 verbose lifecycle apanpie@0.0.0~start: unsafe-perm in lifecycle true 10 verbose lifecycle apanpie@0.0.0~start: PATH: /home/apanpie/.nvm/versions/node/v7.4.0/lib/node_modules/npm/bin/node-gyp-bin:/home/apanpie/node_modules/.bin:/home/apanpie/.nvm/versions/node/v7.4.0/bin:/home/apanpie/bin:/home/apanpie/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin 11 verbose lifecycle apanpie@0.0.0~start: CWD: /home/apanpie 12 silly lifecycle apanpie@0.0.0~start: Args: [ '-c', 'ng serve' ] 13 silly lifecycle apanpie@0.0.0~start: Returned: code: 1 signal: null 14 info lifecycle apanpie@0.0.0~start: Failed to exec start script 15 verbose stack Error: apanpie@0.0.0 start: `ng serve` 15 verbose stack Exit status 1 15 verbose stack at EventEmitter.<anonymous> (/home/apanpie/.nvm/versions/node/v7.4.0/lib/node_modules/npm/lib/utils/lifecycle.js:279:16) 15 verbose stack at emitTwo (events.js:106:13) 15 verbose stack at EventEmitter.emit (events.js:191:7) 15 verbose stack at ChildProcess.<anonymous> (/home/apanpie/.nvm/versions/node/v7.4.0/lib/node_modules/npm/lib/utils/spawn.js:40:14) 15 verbose stack at emitTwo (events.js:106:13) 15 verbose stack at ChildProcess.emit (events.js:191:7) 15 verbose stack at maybeClose (internal/child_process.js:885:16) 15 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 16 verbose pkgid apanpie@0.0.0 17 verbose cwd /home/apanpie/Desktop/angularTest 18 error Linux 4.4.0-59-generic 19 error argv "/home/apanpie/.nvm/versions/node/v7.4.0/bin/node" "/home/apanpie/.nvm/versions/node/v7.4.0/bin/npm" "start" 20 error node v7.4.0 21 error npm v4.0.5 22 error code ELIFECYCLE 23 error apanpie@0.0.0 start: `ng serve` 23 error Exit status 1 24 error Failed at the apanpie@0.0.0 start script 'ng serve'. 24 error Make sure you have the latest version of node.js and npm installed. 24 error If you do, this is most likely a problem with the apanpie package, 24 error not with npm itself. 24 error Tell the author that this fails on your system: 24 error ng serve 24 error You can get information on how to open an issue for this project with: 24 error npm bugs apanpie 24 error Or if that isn't available, you can get their info via: 24 error npm owner ls apanpie 24 error There is likely additional logging output above. 25 verbose exit [ 1, true ]
So I've searched all around the Google Globe, but found nothing.
Also, I don't know if this is related, but in my TypeScript code:
import { View, Component } from '@angular2/core'; [... Components Here ... ]
it throws an error:
Cannot find module '@angular2/core'
If anyone could enlighten me, that would make me so happy!
原文:https://stackoverflow.com/questions/41791944
最满意答案
我知道这不能回答你为什么代码不适合你的问题,但是如果你想要一个稍微更好/更好的方法来实现你的代码,你可以把你的值扔到地图中,这样你就不必使用了一个
switch
声明:class ValueTests { public static final String HIGH_STRING = "high" public static final String LOW_STRING = "low" @Test void stuff() { assert "string was high" == getValue("high") assert "string was low" == getValue("low") assert "no match" == getValue("higher") } def getValue(String key) { def valuesMap = [ (HIGH_STRING): "string was high", (LOW_STRING):"string was low" ] valuesMap.get(key) ?: "no match" } }
比
switch
IMO更清洁一点。I know this doesn't answer your question of why your code is not working for you, but if you want a slightly groovier/better way to implement your code you could throw your values into a map so then you wouldn't have to use a
switch
statement:class ValueTests { public static final String HIGH_STRING = "high" public static final String LOW_STRING = "low" @Test void stuff() { assert "string was high" == getValue("high") assert "string was low" == getValue("low") assert "no match" == getValue("higher") } def getValue(String key) { def valuesMap = [ (HIGH_STRING): "string was high", (LOW_STRING):"string was low" ] valuesMap.get(key) ?: "no match" } }
A little cleaner than a
switch
IMO.
相关问答
更多-
因为str是null,这不是一个String 。 instanceof关键字询问引用指向的对象,而不是引用类型。 编辑 尝试这个... static void main(args) { String str = 'King Crimson Rocks!' if(str instanceof String) { println "'str' is a String!" } else { println "I have absolutely no ide ...
-
您无法在场景中使用switch 。 switch语句需要一个整数类型或字符串作为参数(更多细节如下) 。 您不能将EventArgs作为参数传递给switch语句, case语句也需要编译时常量值。 如果你看一下C#5.0规格 : switch语句的控制类型由switch表达式建立。 如果switch表达式的类型是sbyte,byte,short,ushort,int,uint,long,ulong,bool,char,string或enum-type,或者如果它是与这些类型之一对应的可空类型,然后 是sw ...
-
可以转换为块,但不能以初始化绕过声明的方式。 除非变量具有标量类型,带有普通默认构造函数的类类型和普通的析构函数,否则从具有自动存储持续时间的变量不在范围内的点跳到90的程序是不正确的。这些类型之一的cv限定版本,或者前面类型之一的数组,并且在没有初始值设定项的情况下声明(8.5)。 ([stmt.dcl] / 3) 直观的解释是,如果它执行的初始化实际上是无操作,则只能跳过声明。 如果提供了值,则不能跳过它。 如果类的构造函数中有任何代码,则不能跳过它。 It is possible to transfe ...
-
不要反对这种语言。 C ++ switch语句中的case标签需要是可编译时间可评估的常量表达式 ,而C ++标准库std::map或std::unordered_map当前不提供该标签。 改为使用if else块。 它甚至可能更快 - 特别是如果你选择了最佳订单。 switch 字符数组 (例如'+x' ;注意单引号字符)通常作为4个字符或更少的替代字符,但即使这样也不可移植。 Don't fight the language. The case labels in a C++ switch statem ...
-
请试试这个... 1. activity_main.xml
运行Groovy应用程序(Run Groovy application)[2020-11-09]
对于简单的情况,您可以使用-l标志以“监听”模式运行Groovy脚本,如下所示: groovy -l 9010 SimpleServer.groovy 这将启动SimpleServer脚本侦听端口9010.我从mrhaki的Groovy Goodness博客中获取此示例: http ://mrhaki.blogspot.com/2009/12/groovy-goodness-serversocket-scripts.html。 查看完整的示例。 For simple cases you can run y ...为什么if-else for String比switch-case for enum更快?(Why is if-else for String faster than switch-case for enum?)[2023-08-23]
因为99%的时间花在StringOptions option = StringOptions.valueOf(input); ,而不是在switch Because 99% of your time is being spent in StringOptions option = StringOptions.valueOf(input);, not in the switch我知道这不能回答你为什么代码不适合你的问题,但是如果你想要一个稍微更好/更好的方法来实现你的代码,你可以把你的值扔到地图中,这样你就不必使用了一个switch声明: class ValueTests { public static final String HIGH_STRING = "high" public static final String LOW_STRING = "low" @Test void stuff() { assert "strin ...您正以非常奇怪的方式使用run变量。 由于您在循环结束时将run设置为false ,因此循环将永远不会重复。 如果更改它以便只有有效选项设置为run=false ,则输入错误的选项将导致循环再次运行。 在switch语句的末尾删除run=false ,在System.out.println("OptionX");之后添加System.out.println("OptionX"); You are using the run variable in a very odd way. Since you set ...主要问题是display_menu发生的事情与OnlineStore的处理之间没有上下文关系。 相反,为什么不让display_menu返回所选的值/选项,并将其包含在switch语句中 public class OnlineStore { // public static void main(String[] args) // main program public int display_menu() // Not the main program but the main menu ...相关文章
更多- Hive 终端产生的问题 (Failed to start database 'metastore_db', see the next exception for details.)
- Hadoop1.0.3的start-dfs.sh系列脚本分析
- Solr DIH Quick Start
- How to Start a Business in 10 Days
- getting start with storm 翻译 第八章 part-2
- Storm 【开发细节】 - geting Start with Storm
- 关于Thread类中的start()方法和run()方法
- Hadoop学习笔记(一)HBase脚本分析(一)start-hbase.sh
- getting start with storm 翻译 第二章 part-1
- flume-ng+Kafka+Storm+HDFS 实时系统搭建
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)