2017-07-26 60 views
-1

我在使用MEAN.io建設項目時遇到問題。我經歷了所有的由MEAN.io給出的步驟運行,但我收到以下錯誤:用MEAN.io建設意味着項目的麻煩

npm ERR! Cannot read property '0' of undefined 

步驟:

  1. 我創建了一個全新的Ubuntu實例與C9。
  2. 升級NPM到5.3.0
  3. 與NVM
  4. 升級的節點8.2.1
  5. 走到mean.io,隨後有指示
    • sudo npm install -g mean-cli
    • mean init testapp
    • 有以下錯誤

錯誤:

Cloning into 'testapp'... 
/home/ubuntu/.npm/_locks/npm-eb15ca27eba77bee.lock 
/home/ubuntu/.npm/anonymous-cli-metrics.json 
There are 3 files in your ~/.npm owned by root 
Please change the permissions by running - chown -R `whoami` ~/.npm 

/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/mean-cli/lib/install.js:52 
     if (err) throw err; 
      ^
ROOT PERMISSIONS IN NPM 
  • 運行下面的命令:sudo chown -R WHOAMI ~/.npm
  • 刪除是否意味着init建立
  • Rerean該命令的testapp文件夾:mean init testapp
  • 出現該項目已成功創建
  • 我收到以下消息:
  • 消息:

    Install node package dependencies: 
        $ cd testapp && npm install 
        Bower install should be triggered for client side dependencies. 
        If it did not run invoke it manually... 
        $ cd testapp && bower install 
        Run the app by running: 
        $ cd testapp and then run.. 
        $ gulp 
    
  • cd testapp && npm install
  • 得到以下輸出
  • 輸出:

    > [email protected] install /home/ubuntu/workspace/testapp/node_modules/node-sass 
    > node scripts/install.js 
    
    Cached binary found at /home/ubuntu/.npm/node-sass/4.5.3/linux-x64-57_binding.node 
    
    > [email protected] postinstall /home/ubuntu/workspace/testapp/node_modules/node-sass 
    > node scripts/build.js 
    
    Binary found at /home/ubuntu/workspace/testapp/node_modules/node-sass/vendor/linux-x64-57/binding.node 
    Testing binary 
    Binary is fine 
    
    > [email protected] postinstall /home/ubuntu/workspace/testapp 
    > npm run webdriver:update 
    
    
    > [email protected] webdriver:update /home/ubuntu/workspace/testapp 
    > webdriver-manager update 
    
    [19:17:48] I/file_manager - creating folder /home/ubuntu/workspace/testapp/node_modules/protractor/node_modules/webdriver-manager/selenium 
    [19:17:49] I/update - chromedriver: unzipping chromedriver_2.31.zip 
    [19:17:49] I/update - chromedriver: setting permissions to 0755 for /home/ubuntu/workspace/testapp/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.31 
    [19:17:50] I/update - geckodriver: unzipping geckodriver-v0.18.0.tar.gz 
    [19:17:50] I/update - geckodriver: setting permissions to 0755 for /home/ubuntu/workspace/testapp/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.18.0 
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents): 
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 
    
  • 嘗試運行吞嚥,但得到一個錯誤
  • 錯誤:

    [17:50:10] Local gulp not found in ~/workspace/testapp 
    [17:50:11] Try running: npm install gulp 
    
  • 試圖運行NPM安裝吞(試圖須藤以及),但有以下錯誤
  • 錯誤:

    npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue 
    npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue 
    npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to [email protected]^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. 
    npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed. 
    npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed. 
    npm WARN [email protected] requires a peer of [email protected]~0.6.21 but none was installed. 
    npm WARN [email protected] requires a peer of [email protected]^0.6.1 || ^0.7.0 but none was installed. 
    
    npm ERR! Cannot read property '0' of undefined 
    
    npm ERR! A complete log of this run can be found in: 
    npm ERR!  /home/ubuntu/.npm/_logs/2017-07-26T17_52_19_821Z-debug.log 
    

    這是來自日誌文件的一點輸出

    2238 verbose unlock done using /home/ubuntu/.npm/_locks/staging-719b6a82c67d40a4.lock for /home/ubuntu/workspace/testapp/node_modules/.staging 
    2239 warn @angular/[email protected] requires a peer of @angular/[email protected] but none was installed. 
    2240 warn @angular/[email protected] requires a peer of @angular/[email protected] but none was installed. 
    2241 warn [email protected] requires a peer of [email protected]~0.6.21 but none was installed. 
    2242 warn [email protected] requires a peer of [email protected]^0.6.1 || ^0.7.0 but none was installed. 
    2243 verbose stack TypeError: Cannot read property '0' of undefined 
    2243 verbose stack  at rmStuff (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/lib/unbuild.js:61:24) 
    2243 verbose stack  at tryCatcher (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23) 
    2243 verbose stack  at ret (eval at makeNodePromisifiedEval (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promisify.js:184:12), <anonymous>:13:39) 
    2243 verbose stack  at lifecycle.then.then (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/lib/install/action/unbuild.js:12:12) 
    2243 verbose stack  at tryCatcher (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23) 
    2243 verbose stack  at Promise._settlePromiseFromHandler (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31) 
    2243 verbose stack  at Promise._settlePromise (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18) 
    2243 verbose stack  at Promise._settlePromise0 (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10) 
    2243 verbose stack  at Promise._settlePromises (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18) 
    2243 verbose stack  at Async._drainQueue (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16) 
    2243 verbose stack  at Async._drainQueues (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10) 
    2243 verbose stack  at Immediate.Async.drainQueues (/home/ubuntu/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14) 
    2243 verbose stack  at runCallback (timers.js:781:20) 
    2243 verbose stack  at tryOnImmediate (timers.js:743:5) 
    2243 verbose stack  at processImmediate [as _immediateCallback] (timers.js:714:5) 
    2244 verbose cwd /home/ubuntu/workspace/testapp 
    2245 verbose Linux 4.9.17-c9 
    2246 verbose argv "/home/ubuntu/.nvm/versions/node/v8.2.1/bin/node" "/home/ubuntu/.nvm/versions/node/v8.2.1/bin/npm" "install" "gulp" 
    2247 verbose node v8.2.1 
    2248 verbose npm v5.3.0 
    2249 error Cannot read property '0' of undefined 
    2250 verbose exit [ 1, true ] 
    

    任何想法出了什麼問題?

    回答