无法使用npm在VS2015项目中安装angular2-datatable

时间:2016-06-09 12:33:19

标签: angular npm

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

"angular2-datatable": "^0.4.2"

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

PATH=C:\Program Files\nodejs;%PATH%;.\node_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\nodejs\npm.CMD" install
> angular2-datatable@0.4.2 postinstall C:\hmr9sw\RWD\src\RWD\node_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\Roaming\npm\node_modules\typings\node_modules\rc\lib\utils.js:15:17)
    at addConfigFile (C:\Users\Admin\AppData\Roaming\npm\node_modules\typings\node_modules\rc\index.js:31:20)
    at module.exports (C:\Users\Admin\AppData\Roaming\npm\node_modules\typings\node_modules\rc\index.js:45:3)
    at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\typings\node_modules\typings-core\dist\utils\rc.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 rwd@0.0.0 No description
npm WARN rwd@0.0.0 No repository field.
npm WARN rwd@0.0.0 No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Admin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.2.1
npm ERR! npm  v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! angular2-datatable@0.4.2 postinstall: `cd src && typings install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the angular2-datatable@0.4.2 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\RWD\src\RWD\npm-debug.log

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

1 个答案:

答案 0 :(得分:1)

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