node.js安装 jspm模块 并初始化 jspm 支持ECMAScript6语法
2017-09-10 23:12
561 查看
前言:
—-设置代理:
npm config set registry https://registry.npmjs.org/
—-npm版本号:
安装jspm
1、安装全局jspm,执行命令: npm install jspm -g
2、安装本地jspm,执行命令: npm install jspm –save-dev
3、执行命令:jspm init,初始化jspm,具体过程如下:
注意:
public folder URL 设置为 ./
此时,目录C:\Users\User\Desktop\jspm下的文件就可以使用了,可支持ECMAScrpit 6的语法。
具体用法如下:
还需要注意:
采用ECMAScrpit 6编码的js文件,必须以System.import(“app”);的形式应用,否则因部分ECMAScrpit 6语法得不到浏览器支持而报错。
转载:http://lib.csdn.net/article/nodejs/51017
—-设置代理:
npm config set registry https://registry.npmjs.org/
—-npm版本号:
C:\Users\User>npm version { npm: '3.8.9', ares: '1.10.1-DEV', http_parser: '2.7.0', icu: '57.1', modules: '48', node: '6.2.0', openssl: '1.0.2h', uv: '1.9.1', v8: '5.0.71.47', zlib: '1.2.8' }
安装jspm
1、安装全局jspm,执行命令: npm install jspm -g
2、安装本地jspm,执行命令: npm install jspm –save-dev
3、执行命令:jspm init,初始化jspm,具体过程如下:
C:\Users\User\Desktop\jspm>jspm init Package.json file does not exist, create it? [yes]: Would you like jspm to prefix the jspm package.json properties under jspm? [yes]: Enter server baseURL (public folder path) [./]: Enter jspm packages folder [.\jspm_packages]: Enter config file path [.\config.js]: Configuration file config.js doesn't exist, create it? [yes]: Enter client baseURL (public folder URL) [/]:./ Do you wish to use a transpiler? [yes]: Which ES6 transpiler would you like to use, Babel, TypeScript or Traceur? [babel]: ok Verified package.json at package.json Verified config file at config.js Looking up loader files... system.src.js system.js system-csp-production.src.js system-csp-production.js system.js.map system-polyfills.js system-polyfills.js.map system-polyfills.src.js system-csp-production.js.map Using loader versions: systemjs@0.19.27 Looking up npm:babel-core Looking up npm:babel-runtime Looking up npm:core-js Updating registry cache... Looking up github:jspm/nodelibs-process Looking up github:jspm/nodelibs-path ok Installed babel as npm:babel-core@^5.8.24 (5.8.38) Looking up github:systemjs/plugin-json Looking up npm:process warn Timed out on locate for github:jspm/nodelibs-fs, retrying (1). To increase the timeout run jspm config registries.github.timeouts.lookup 120 warn Timed out on lookup for github:jspm/nodelibs-path, retrying (1). To increase the timeout run jspm config registries.github.timeouts.lookup 120 warn Timed out on lookup for github:systemjs/plugin-json, retrying (1). To increase the timeout run jspm config registries.github.timeouts.lookup 120 ok Installed github:jspm/nodelibs-process@^0.1.0 (0.1.2) ok Installed npm:process@^0.11.0 (0.11.3) Looking up github:jspm/nodelibs-fs ok Installed github:systemjs/plugin-json@^0.1.0 (0.1.2) Looking up github:jspm/nodelibs-assert ok Installed github:jspm/nodelibs-fs@^0.1.0 (0.1.2) Looking up npm:assert ok Installed github:jspm/nodelibs-assert@^0.1.0 (0.1.0) Looking up npm:buffer-shims Looking up npm:util ok Installed npm:assert@^1.3.0 (1.4.0) ok Installed npm:buffer-shims@1.0.0 (1.0.0) Looking up npm:inherits ok Installed npm:util@0.10.3 (0.10.3) ok Installed npm:inherits@2.0.1 (2.0.1) Looking up npm:path-browserify ok Installed github:jspm/nodelibs-path@^0.1.0 (0.1.0) Looking up github:jspm/nodelibs-util ok Installed npm:path-browserify@0.0.0 (0.0.0) Looking up github:jspm/nodelibs-buffer Looking up npm:buffer ok Installed github:jspm/nodelibs-buffer@^0.1.0 (0.1.0) Looking up npm:base64-js Looking up npm:ieee754 Looking up npm:isarray ok Installed npm:buffer@^3.0.1 (3.6.0) ok Installed npm:base64-js@0.0.8 (0.0.8) ok Installed npm:ieee754@^1.1.4 (1.1.6) ok Installed npm:isarray@^1.0.0 (1.0.0) Looking up github:jspm/nodelibs-child_process ok Installed github:jspm/nodelibs-util@^0.1.0 (0.1.0) ok Installed github:jspm/nodelibs-child_process@^0.1.0 (0.1.0) ok Installed core-js as npm:core-js@^1.1.4 (1.2.6) ok Installed babel-runtime as npm:babel-runtime@^5.8.24 (5.8.38) ok Loader files downloaded successfully
注意:
public folder URL 设置为 ./
此时,目录C:\Users\User\Desktop\jspm下的文件就可以使用了,可支持ECMAScrpit 6的语法。
具体用法如下:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>index</title> <script type="text/javascript" src="jspm_packages/system.js"></script> <script type="text/javascript" src="config.js"></script> <script type="text/javascript"> System.import("app"); </script> </head> <body> </body> </html>
还需要注意:
采用ECMAScrpit 6编码的js文件,必须以System.import(“app”);的形式应用,否则因部分ECMAScrpit 6语法得不到浏览器支持而报错。
转载:http://lib.csdn.net/article/nodejs/51017
相关文章推荐
- node.js安装jspm模块并初始化jspm支持ECMAScript6语法
- node.js的安装与第一个hello world、node.js的初始化
- 在Windows上安装Node.js模块的方法
- npm安装node.js模块切至淘宝源安装提升下载速度
- 使用 Node.js 的 nodemailer 模块发送邮件(支持 QQ、163 等、支持附件)
- Node.js模块全局安装路径配置方法
- 在Windows上安装Node.js模块
- 第1章-安装Node.js及相关要点-1.7.使用Node.js的HTTP模块来创建一个简单服务器
- 在Windows平台上安装Node.js及NPM模块管理
- 使用 Node.js 的 nodemailer 模块发送邮件(支持 QQ、163 等、支持附件)
- 如何安装node.js支持插件
- Node.js模块全局安装路径配置
- node.js中npm安装的模块在哪个目录下
- node.js之npm安装模块的路径
- 在Windows上安装Node.js模块的方法
- 在Windows平台上安装Node.js及NPM模块管理
- 在Node.js环境下安装heapdump模块工具
- Ubuntu14.04LTS下安装Node.js&NPM以及个人博客hexo的初始化配置
- Node.js开发指南——第3章安装Node.js快速入门(四)模块和包
- node.js 第三方模块如何安装(使用npm)及介绍