• Mac 下vue环境安装


    Last login: Sun Jun 30 09:21:27 on ttys002
    loginuser s-MacBook-Pro:~ loginuser  npm -v
    6.9.2                                           // 1.查看npm版本
    loginuser s-MacBook-Pro:~ loginuser  node -version
    node: bad option: -version
    loginuser s-MacBook-Pro:~ loginuser  node -v
    v8.11.3                         //2. 查看node.js版本          
    loginuser s-MacBook-Pro:~ loginuser  sudo -s
    Password:                                       //3. 管理员权限
    bash-3.2# npm install -g cnpm --registry=https://registry.npm.taobao.org // 4. 安装cnpm 失败,没有路径访问权限
    Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/loginuser /.npm/_cacache/content-v2/sha512/04/7a'
    
    npm ERR! cb() never called!
    
    npm ERR! This is an error with npm itself. Please report this error at:
    npm ERR!     <https://npm.community>
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/loginuser /.npm/_logs/2019-06-30T02_04_39_468Z-debug.log
    bash-3.2# sudo chmod -R 777 /usr/local/lib/node_modules/
    bash-3.2# npm install -g cnpm --registry=https://registry.npm.taobao.org
    Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/loginuser /.npm/_cacache/index-v5/87/99'
    
    npm ERR! cb() never called!
    
    npm ERR! This is an error with npm itself. Please report this error at:
    npm ERR!     <https://npm.community>
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/loginuser /.npm/_logs/2019-06-30T02_05_06_015Z-debug.log
    bash-3.2# sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
    npm ERR! path /Users/loginuser /.npm/_locks
    npm ERR! code EISDIR
    npm ERR! errno -21
    npm ERR! syscall open
    npm ERR! EISDIR: illegal operation on a directory, open '/Users/loginuser /.npm/_locks'
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/loginuser /.npm/_logs/2019-06-30T02_06_02_055Z-debug.log
    bash-3.2# sudo chown -R $USER /usr/local
    bash-3.2# sudo chown -R $USER /usr/loginuser 
    chown: /usr/loginuser : No such file or directory
    bash-3.2# sudo chown -R $USER /users/loginuser                    //5.添加路径访问权限
    bash-3.2# sudo npm install -g cnpm --registry=https://registry.npm.taobao.org// 6. 再次安装cnpm成功
    /usr/local/bin/cnpm -> /usr/local/lib/node_modules/cnpm/bin/cnpm
    + cnpm@6.1.0
    added 682 packages from 900 contributors in 15.545s
    bash-3.2# cnpm install webpack -g                                  //7.安装webpack
    Downloading webpack to /usr/local/lib/node_modules/webpack_tmp
    Copying /usr/local/lib/node_modules/webpack_tmp/_webpack@4.35.0@webpack to /usr/local/lib/node_modules/webpack
    Installing webpack's dependencies to /usr/local/lib/node_modules/webpack/node_modules
    [1/24] acorn@^6.0.5 installed at node_modules/_acorn@6.1.1@acorn
    [2/24] acorn-dynamic-import@^4.0.0 installed at node_modules/_acorn-dynamic-import@4.0.0@acorn-dynamic-import
    [3/24] ajv-keywords@^3.1.0 installed at node_modules/_ajv-keywords@3.4.0@ajv-keywords
    [4/24] @webassemblyjs/helper-module-context@1.8.5 installed at node_modules/_@webassemblyjs_helper-module-context@1.8.5@@webassemblyjs/helper-module-context
    [5/24] chrome-trace-event@^1.0.0 installed at node_modules/_chrome-trace-event@1.0.2@chrome-trace-event
    [6/24] memory-fs@~0.4.1 existed at node_modules/_memory-fs@0.4.1@memory-fs
    [7/24] json-parse-better-errors@^1.0.2 installed at node_modules/_json-parse-better-errors@1.0.2@json-parse-better-errors
    [8/24] loader-runner@^2.3.0 installed at node_modules/_loader-runner@2.4.0@loader-runner
    [9/24] ajv@^6.1.0 installed at node_modules/_ajv@6.10.0@ajv
    [10/24] eslint-scope@^4.0.0 installed at node_modules/_eslint-scope@4.0.3@eslint-scope
    [11/24] neo-async@^2.5.0 installed at node_modules/_neo-async@2.6.1@neo-async
    [12/24] tapable@^1.1.0 existed at node_modules/_tapable@1.1.3@tapable
    [13/24] @webassemblyjs/wasm-parser@1.8.5 installed at node_modules/_@webassemblyjs_wasm-parser@1.8.5@@webassemblyjs/wasm-parser
    [14/24] @webassemblyjs/wasm-edit@1.8.5 installed at node_modules/_@webassemblyjs_wasm-edit@1.8.5@@webassemblyjs/wasm-edit
    [15/24] @webassemblyjs/ast@1.8.5 installed at node_modules/_@webassemblyjs_ast@1.8.5@@webassemblyjs/ast
    [16/24] mkdirp@~0.5.0 installed at node_modules/_mkdirp@0.5.1@mkdirp
    [17/24] enhanced-resolve@^4.1.0 installed at node_modules/_enhanced-resolve@4.1.0@enhanced-resolve
    [18/24] loader-utils@^1.1.0 installed at node_modules/_loader-utils@1.2.3@loader-utils
    [19/24] schema-utils@^1.0.0 installed at node_modules/_schema-utils@1.0.0@schema-utils
    [20/24] webpack-sources@^1.3.0 installed at node_modules/_webpack-sources@1.3.0@webpack-sources
    fsevents@1.2.9 download from binary mirror: {"module_name":"fse","module_path":"./lib/binding/{configuration}/{node_abi}-{platform}-{arch}/","remote_path":"./v{version}/","package_name":"{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz","host":"https://cdn.npm.taobao.org/dist/fsevents"}
    [21/24] node-libs-browser@^2.0.0 installed at node_modules/_node-libs-browser@2.2.1@node-libs-browser
    [22/24] watchpack@^1.5.0 installed at node_modules/_watchpack@1.6.0@watchpack
    [23/24] micromatch@^3.1.8 installed at node_modules/_micromatch@3.1.10@micromatch
    [24/24] terser-webpack-plugin@^1.1.0 installed at node_modules/_terser-webpack-plugin@1.3.0@terser-webpack-plugin
    execute post install 1 scripts...
    [1/1] scripts.install watchpack@1.6.0 › chokidar@2.1.6 › fsevents@^1.2.7 run "node install", root: "/usr/local/lib/node_modules/webpack/node_modules/_fsevents@1.2.9@fsevents"
    node-pre-gyp WARN Using needle for node-pre-gyp https download 
    node-pre-gyp http GET https://cdn.npm.taobao.org/dist/fsevents/v1.2.9/fse-v1.2.9-node-v57-darwin-x64.tar.gz
    node-pre-gyp http 200 https://cdn.npm.taobao.org/dist/fsevents/v1.2.9/fse-v1.2.9-node-v57-darwin-x64.tar.gz
    [fsevents] Success: "/usr/local/lib/node_modules/webpack/node_modules/_fsevents@1.2.9@fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" is installed via remote
    [1/1] scripts.install watchpack@1.6.0 › chokidar@2.1.6 › fsevents@^1.2.7 finished in 354ms
    Recently updated (since 2019-06-23): 6 packages (detail see file /usr/local/lib/node_modules/webpack/node_modules/.recently_updates.txt)
      Today:
        → terser-webpack-plugin@1.3.0 › terser@^4.0.0(4.0.1) (01:11:13)
      2019-06-27
        → enhanced-resolve@4.1.0 › graceful-fs@^4.1.2(4.2.0) (03:39:25)
      2019-06-26
        → node-libs-browser@2.2.1 › crypto-browserify@3.12.0 › browserify-sign@4.0.4 › elliptic@^6.0.0(6.5.0) (12:03:46)
      2019-06-25
        → micromatch@3.1.10 › snapdragon@0.8.2 › base@0.11.2 › mixin-deep@^1.2.0(1.3.2) (04:33:47)
        → micromatch@3.1.10 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › set-value@^2.0.0(2.0.1) (05:06:17)
        → micromatch@3.1.10 › snapdragon@0.8.2 › base@0.11.2 › cache-base@1.0.1 › union-value@^1.0.0(1.0.1) (05:09:47)
    All packages installed (295 packages installed from npm registry, used 4s(network 4s), speed 1.29MB/s, json 271(476.28kB), tarball 4.58MB)
    [webpack@4.35.0] link /usr/local/bin/webpack@ -> /usr/local/lib/node_modules/webpack/bin/webpack.js
    bash-3.2# sudo npm install -g vue-cli                           //8.安装vue-cli
    npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
    /usr/local/bin/vue -> /usr/local/lib/node_modules/vue-cli/bin/vue
    /usr/local/bin/vue-init -> /usr/local/lib/node_modules/vue-cli/bin/vue-init
    /usr/local/bin/vue-list -> /usr/local/lib/node_modules/vue-cli/bin/vue-list
    + vue-cli@2.9.6
    added 239 packages from 206 contributors in 120.532s
    bash-3.2# vue list                          //9.查看 vue list
    
      Available official templates:
    
      ★  browserify - A full-featured Browserify + vueify setup with hot-reload, linting & unit testing.
      ★  browserify-simple - A simple Browserify + vueify setup for quick prototyping.
      ★  pwa - PWA template for vue-cli based on the webpack template
      ★  simple - The simplest possible Vue setup in a single HTML file
      ★  webpack - A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction.
      ★  webpack-simple - A simple Webpack + vue-loader setup for quick prototyping.
    
    bash-3.2# cd documents/vue                                //10.切换到自定义目录
    bash-3.2# vue init webpack-simple test1                    //11.创建工程文件 test1
    
    ? Project name test1
    ? Project description A Vue.js project
    ? Author albert
    ? License MIT
    ? Use sass? No
    
       vue-cli · Generated "test1".
    
       To get started:
       
         cd test1
         npm install
         npm run dev
    
    bash-3.2# cd test1                                          //12.切到工程目录
    bash-3.2# cnpm install                                      //13.安装
    ✔ Installed 12 packages
    ✔ Linked 614 latest versions
    [1/3] scripts.postinstall babel-core@6.26.3 › babel-register@6.26.0 › core-js@^2.5.0 run "node scripts/postinstall || echo "ignore"", root: "/Users/loginuser /Documents/vue/test1/node_modules/_core-js@2.6.9@core-js"
    Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
    
    The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
    > https://opencollective.com/core-js 
    > https://www.patreon.com/zloirock 
    
    Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
    
    [1/3] scripts.postinstall babel-core@6.26.3 › babel-register@6.26.0 › core-js@^2.5.0 finished in 93ms
    [2/3] scripts.install webpack-dev-server@2.11.5 › chokidar@2.1.6 › fsevents@^1.2.7 run "node install", root: "/Users/loginuser /Documents/vue/test1/node_modules/_fsevents@1.2.9@fsevents"
    node-pre-gyp WARN Using needle for node-pre-gyp https download 
    node-pre-gyp http GET https://cdn.npm.taobao.org/dist/fsevents/v1.2.9/fse-v1.2.9-node-v57-darwin-x64.tar.gz
    node-pre-gyp http 200 https://cdn.npm.taobao.org/dist/fsevents/v1.2.9/fse-v1.2.9-node-v57-darwin-x64.tar.gz
    [fsevents] Success: "/Users/loginuser /Documents/vue/test1/node_modules/_fsevents@1.2.9@fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" is installed via remote
    [2/3] scripts.install webpack-dev-server@2.11.5 › chokidar@2.1.6 › fsevents@^1.2.7 finished in 480ms
    [3/3] scripts.postinstall webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 run "node lib/post_install.js", root: "/Users/loginuser /Documents/vue/test1/node_modules/_uglifyjs-webpack-plugin@0.4.6@uglifyjs-webpack-plugin"
    [3/3] scripts.postinstall webpack@3.12.0 › uglifyjs-webpack-plugin@^0.4.6 finished in 85ms
    ✔ Run 3 scripts
    deprecate css-loader@0.28.11 › cssnano@3.10.0 › autoprefixer@6.7.7 › browserslist@^1.7.6 Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
    Recently updated (since 2019-06-23): 9 packages (detail see file /Users/loginuser /Documents/vue/test1/node_modules/.recently_updates.txt)
      Today:
        → css-loader@0.28.11 › cssnano@3.10.0 › autoprefixer@6.7.7 › browserslist@1.7.7 › electron-to-chromium@^1.2.7(1.3.178) (04:02:36)
    ✔ All packages installed (701 packages installed from npm registry, used 9s(network 9s), speed 1.8MB/s, json 626(1.42MB), tarball 14.01MB)
    bash-3.2# cnpm install vue-router vue-resource --save
    ✔ Installed 2 packages
    ✔ Linked 39 latest versions
    ✔ Run 0 scripts
    ✔ All packages installed (32 packages installed from npm registry, used 2s(network 2s), speed 208.12kB/s, json 41(65.25kB), tarball 374.52kB)
    bash-3.2# cnpm run dev                                       //14. 启动项目
    
    > test1@1.0.0 dev /Users/loginuser /Documents/vue/test1
    > cross-env NODE_ENV=development webpack-dev-server --open --hot
    
    Project is running at http://localhost:8080/
    webpack output is served from /dist/
    404s will fallback to /index.html
    { parser: "babylon" } is deprecated; we now treat it as { parser: "babel" }.

    得到启动界面啦



    转载于:https://www.cnblogs.com/albertfg/p/11109047.html 

    ‘真实的’活着
  • 相关阅读:
    mysql非安装包安装教程
    HTML和CSS <h1> --3-- <h1>
    HTML和CSS <h1> --2-- <h1>
    HTML和CSS <h1> --1-- <h1>
    软件工程之四则运算总结
    图论算法 有图有代码 万字总结 向前辈致敬
    【万里征程——Windows App开发】使用Toast通知
    【万里征程——Windows App开发】设置共享(共享源和共享目标)
    【万里征程——Windows App开发】如何使用粘贴板
    【万里征程——Windows App开发】在应用中集成搜索
  • 原文地址:https://www.cnblogs.com/chenxi-hxl/p/12447213.html
Copyright © 2020-2023  润新知