关于angular:无法使用npm在VS2015项目中安装angular2-datatable

Can't install angular2-datatable in VS2015 project with npm

我正在用asp.net 5开发一个angular 2 Web应用程序。我想用npm安装angular2-datatable来创建一个表。我已将以下依赖项添加到我的package.json文件中:

1
"angular2-datatable":"^0.4.2"

保存文件后,不会安装依赖项。相反,我得到以下结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
PATH=C:\\Program Files\
odejs;%PATH%;.\
ode_modules\\.bin;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Web\\External;C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Web\\External\\git
"C:\\Program Files\
odejs\
pm.CMD" install
> [email protected] postinstall C:\\hmr9sw\
WD\\src\
WD\
ode_modules\\angular2-datatable
> cd src && typings install
undefined:1
{
^
SyntaxError: Unexpected token  in JSON at position 0
    at Object.parse (native)
    at exports.parse (C:\\Users\\Admin\\AppData\
oaming\
pm\
ode_modules\\typings\
ode_modules\
c\\lib\\utils.js:15:17)
    at addConfigFile (C:\\Users\\Admin\\AppData\
oaming\
pm\
ode_modules\\typings\
ode_modules\
c\\index.js:31:20)
    at module.exports (C:\\Users\\Admin\\AppData\
oaming\
pm\
ode_modules\\typings\
ode_modules\
c\\index.js:45:3)
    at Object. (C:\\Users\\Admin\\AppData\
oaming\
pm\
ode_modules\\typings\
ode_modules\\typings-core\\dist\\utils\
c.js:11:44)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv"C:\\\\Program Files\\\
odejs\\\
ode.exe""C:\\\\Users\\\\Admin\\\\AppData\\\
oaming\\\
pm\\\
ode_modules\\\
pm\\\\bin\\\
pm-cli.js""install"
npm ERR! node v6.2.1
npm ERR! npm  v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: `cd src && typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'cd src && typings install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-datatable package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cd src && typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-datatable
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-datatable
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     C:\\hmr9sw\
WD\\src\
WD\
pm-debug.log

您可以看到我的npm版本是3.9.5,节点版本是6.2.1(因此已更新)。如果我通过cmd运行npm,则会得到相同的结果。


尝试使用angular2-data-table(https://www.npmjs.com/package/angular2-data-table)。它已安装,没有任何错误,并且功能非常好。