<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [TOC] # npm script npm script 和 webpack 就可以做很多事情了,還可以自己寫npm script腳本,來完成自己想做的事情。 ## 參考 [ 我為何放棄Gulp與Grunt,轉投npm scripts(上)](http://blog.csdn.net/ricohzhanglong/article/details/50726141) http://www.cnblogs.com/zldream1106/p/5204599.html [使用npm scripts替代gulp](https://aotu.io/notes/2016/02/26/use-npm-script-instead-of-gulp/) [npm Scripts使用教程【譯】](http://www.cnblogs.com/zldream1106/p/why-npm-scripts.html) > https://docs.npmjs.com/misc/scripts # set-script 示例: ```shell npm set-script start "http-server ." ``` `package.json`: ```json { "name": "my-project", "scripts": { "start": "http-server .", "test": "some existing value" } } ``` > [npm-set-script](https://docs.npmjs.com/cli/v8/commands/npm-set-script) # npm-dist-tag > version 一旦發布,是不可變的; > 而 tag 更像一個渠道,只要用戶選擇了這個渠道,就可以一直更新這個渠道的最新版。 也因此,version 和 tag 是相互獨立的。 ## 切換tag 回到我們的問題,如果不小心把`1.0.0-alpha.1`直接`npm publish`了,我們該怎么辦? ## 查看當前的tag和對應的version。 通過`npm dist-tag ls`,我們可以得到這樣的結果: ~~~css latest: 1.0.0 next: 1.0.0-alpha.0 ~~~ 如果我們不小心發布了一個`1.0.0-alpha.1`到`latest`,那么我們會得到: ~~~css latest: 1.0.0-alpha.1 next: 1.0.0-alpha.0 ~~~ 這個時候我們只要切一下 tag 就可以挽回局面了。 ## 查看發布過的所有版本號 通過`npm v my-package versions`可以得到一個數組: ~~~json [ '0.1.0', '1.0.0', '1.0.0-alpha.0', '1.0.0-alpha.1' ] ~~~ ## 設置 tag,對應到版本 version ``` npm dist-tag add my-package@version tag ``` 如: 1. 把原來的`1.0.0`設置成最新的正式版 ```sh npm dist-tag add my-package@1.0.0 latest ``` 2. 把`1.0.0-alpha.1`更新到最新的測試版 ```sh npm dist-tag add my-package@1.0.0-alpha.1 next ``` 再也不用擔心搞出線上故障了~ > [npm-dist-tag](https://docs.npmjs.com/cli/v8/commands/npm-dist-tag) > https://docs.npmjs.com/adding-dist-tags-to-packages # `npm set` 設置 `package.json` 默認值 當初始化`package.json`可以執行 ``` npm init -y ``` 如果需要設置默認值: ``` npm set init.license "MIT" npm set init.author.email "koopking@gmail.com" npm set init.author.name "Yun.kou" ``` 再來一遍 ``` rm package.json npm init -y ``` 如果你想看默認值和編輯可以查看`~/.npmrc` ``` vim ~/.npmrc ``` # 更新 npm 在Windows上,更新 npm 比較麻煩。Windows 上的問題是 npm是與 node.js一起安裝的, 直接使用: ``` $ npm install --global npm@latest ``` 下載的 npm 的新版本總是會被node 本身的版本所掩蓋。這是因為您的環境變量 `PATH` 中的條目的順序導致的問題。 簡單解決方案:npm-windows-upgrade (https:/?/github.?com/?felixrieseberg/?npm-?windows-?upgrade) 使用管理員權限 運行以下命令: ``` $ npm install -g npm-windows-upgrade $ npm-windows-upgrade ``` check out the official release notes: https:/?/ github.?com/?npm/?cli/ # `.npmrc` file There are a few different points here: 1. Where is the`.npmrc`file created. 2. How can you download private packages Running`npm config ls -l`will show you all the implicit settings for npm, including what it thinks is the right place to put the`.npmrc`. But if you have never logged in (using`npm login`) it will be empty. Simply log in to create it. Another thing is #2. You can actually do that by putting a`.npmrc`file in the NPM package's root. It will then be used by NPM when authenticating. It also supports variable interpolation from your shell so you could do stuff like this: ~~~ ; Get the auth token to use for fetching private packages from our private scope ; see http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules ; and also https://docs.npmjs.com/files/npmrc //registry.npmjs.org/:_authToken=${NPM_TOKEN} ~~~ **Pointers** * [http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules](http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules) * [https://docs.npmjs.com/files/npmrc](https://docs.npmjs.com/files/npmrc) # [`node-gyp`](https://github.com/TooTallNate/node-gyp) need Visual C++ runtime libraries The way to resolve this is to install Visual Studio. At the time of this writing (Feb 2015) the compilation works fine with [Visual Studio 2013 Update 4](http://www.visualstudio.com/en-us/news/vs2013-update4-rc-vs.aspx). You can then tell npm which version of Visual Studio you are using by the following command: ```shell $ npm install -g browser-sync --msvs_version=2013 ``` After installation of Visual Studio npm should not throw errors any longer, but only issue warnings. As far as we can tell, they do not impact Browsersync. **正確姿勢** 在項目目錄 執行, macOS 系統直接運行下面的命令即可: ~~~ SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install?node-sass ~~~ windows 下的可以拆分成兩個命令 ~~~ set SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install node-sass ~~~ # node-sass 安裝失敗 解決辦法 https://segmentfault.com/a/1190000010984731 [node-sass 安裝失敗 win32-x64-57_binding.node](https://www.jianshu.com/p/145cc862ceec) 注意查看 [win32-x64-59_binding.node](https://github.com/sass/node-sass/releases/) 是否支持你的node版本 ## 設置 node-sass 路徑 安裝 node-sass 的時候總是會各種不成功,~翻墻,解決一切問題~ **正確姿勢** 在項目目錄 執行, macOS 系統直接運行下面的命令即可: ~~~ SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install?node-sass ~~~ windows 下的可以拆分成兩個命令 ~~~ set SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install node-sass ~~~ 第一種:直接右鍵我的電腦--》屬性--》高級系統設置--》環境變量--》添加。 第二種:set XXX=文件路經 --》`set SASS_BINARY_PATH=D:\Applications\win32-x64-64_binding.node` 查看環境是否合適:`echo %SASS_BINARY_PATH%` 第三種:我們可以在`.npmrc`中直接設置它們的鏡像地址,添加`node-sass`的鏡像地址: ~~~ # .npmrc SASS_BINARY_SITE=http://npm.taobao.org/mirrors/node-sass ~~~ ## 然后安裝 node-sass 模塊 ``` npm rebuild node-sass 或者 npm i node-sass -D --verbose ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看