1

我正在尝试运行简单的 Angular 2 单元测试应用程序。我已经在 git 下克隆并按照自述文件中给出的步骤进行操作。

https://github.com/matthewharwood/Hit-the-gym

我为 npm 设置了代理设置,并为 git 禁用了 strict-ssl 设置。我还为 http_proxy 和 https_proxy 导出了环境变量。

当我在命令下运行时

npm install

它为“jspm install”命令引发错误,如下所示:

    C:\angularjs20\unit-test1\Hit-the-gym>npm install
    npm WARN package.json @ No repository field.
    npm WARN optional dep failed, continuing fsevents@0.3.8
    |
    > phantomjs@1.9.18 install C:\angularjs20\unit-test1\Hit-the-gym\node_modules\p
    antomjs
    > node install.js

    Download already available at C:\Users\bchavan\AppData\Local\Temp\phantomjs\pha
    tomjs-1.9.8-windows.zip
    Extracting zip contents
    Removing C:\angularjs20\unit-test1\Hit-the-gym\node_modules\phantomjs\lib\phant
    m
    Copying extracted folder C:\Users\bchavan\AppData\Local\Temp\phantomjs\phantomj
    -1.9.8-windows.zip-extract-1440415812246\phantomjs-1.9.8-windows -> C:\angularj
    20\unit-test1\Hit-the-gym\node_modules\phantomjs\lib\phantom
    Writing location.js file
    Done. Phantomjs binary available at C:\angularjs20\unit-test1\Hit-the-gym\node_
    odules\phantomjs\lib\phantom\phantomjs.exe
    -
    > ws@0.4.32 install C:\angularjs20\unit-test1\Hit-the-gym\node_modules\karma\no
    e_modules\socket.io\node_modules\socket.io-client\node_modules\ws
    > (node-gyp rebuild 2> builderror.log) || (exit 0)


    C:\angularjs20\unit-test1\Hit-the-gym\node_modules\karma\node_modules\socket.io
    node_modules\socket.io-client\node_modules\ws>if not defined npm_config_node_gy
     (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_m
    dules\node-gyp\bin\node-gyp.js" rebuild )  else (rebuild)
    -
    > @ postinstall C:\angularjs20\unit-test1\Hit-the-gym
    > jspm install

         Looking up npm:jquery

    warn Error on lookup for npm:jquery, retrying (1).
         Error: unable to verify the first certificate
             at Error (native)
             at TLSSocket.<anonymous> (_tls_wrap.js:929:36)
             at TLSSocket.emit (events.js:104:17)
             at TLSSocket._finishInit (_tls_wrap.js:460:8)

    warn Error on lookup for npm:jquery, retrying (2).
         Error: unable to verify the first certificate
             at Error (native)
             at TLSSocket.<anonymous> (_tls_wrap.js:929:36)
             at TLSSocket.emit (events.js:104:17)
             at TLSSocket._finishInit (_tls_wrap.js:460:8)

    warn Error on lookup for npm:jquery, retrying (3).
         Error: unable to verify the first certificate
             at Error (native)
             at TLSSocket.<anonymous> (_tls_wrap.js:929:36)
             at TLSSocket.emit (events.js:104:17)
             at TLSSocket._finishInit (_tls_wrap.js:460:8)

    warn Error on lookup for npm:jquery
         Error: unable to verify the first certificate
             at Error (native)
             at TLSSocket.<anonymous> (_tls_wrap.js:929:36)
             at TLSSocket.emit (events.js:104:17)
             at TLSSocket._finishInit (_tls_wrap.js:460:8)

    err  Error looking up npm:jquery.

    warn Installation changes not saved.

    npm ERR! Windows_NT 6.1.7601
    npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodej
    \\node_modules\\npm\\bin\\npm-cli.js" "install"
    npm ERR! node v0.12.2
    npm ERR! npm  v2.7.4
    npm ERR! code ELIFECYCLE
    npm ERR! @ postinstall: `jspm install`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the @ postinstall script 'jspm install'.
    npm ERR! This is most likely a problem with the  package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     jspm install
    npm ERR! You can get their info via:
    npm ERR!     npm owner ls
    npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request:
    npm ERR!     C:\angularjs20\unit-test1\Hit-the-gym\npm-debug.log

以下是 package.json 文件内容:

        {
     "jspm": {
       "directories": {},
       "dependencies": {
         "jquery": "npm:jquery@^2.1.4"
       },
       "devDependencies": {
         "traceur": "github:jmcriffey/bower-traceur@0.0.89",
         "traceur-runtime": "github:jmcriffey/bower-traceur-runtime@0.0.89"
       }
     },
     "scripts": {
       "postinstall": "jspm install",
       "start": "live-server --open=client/index.html --port=9090 ./"
     },
     "devDependencies": {
       "jasmine-core": "^2.3.4",
       "jspm": "^0.15.6",
       "karma": "^0.12.35",
       "karma-chrome-launcher": "^0.1.12",
       "karma-coverage": "^0.3.1",
       "karma-jasmine": "^0.3.5",
       "karma-jspm": "^1.1.5",
       "karma-phantomjs-launcher": "^0.2.0",
       "phantomjs": "^1.9.17"
     }

有人可以帮我解决这个问题吗?

非常感谢任何帮助!

4

1 回答 1

-1

我也遇到了 npm 的问题,但我不确定是否是同一个问题。对不起,如果没有。

我已通过在文件中添加“strict-ssl=false”行来修复它:C:\Users{username}\npmrc(如果不存在则创建)

于 2015-08-24T13:20:22.713 回答