npm

npm ERR! Unexpected end of JSON input while parsing near ‘...“:“^1.2.0“,“vue-html-‘ npm ERR! A comp

若如初见. 提交于 2020-12-16 13:06:36
当我们使用vue-cli脚手架创建项目的时候,出现了这的问题,这是npm下载出错了。 错误提示: Vue CLI v4 . 5.9 Creating project in C : \Users\lenovo\Desktop\ffff\hello . Installing CLI plugins . This might take a while . . . npm ERR ! Unexpected end of JSON input while parsing near '...":"^1.2.0","vue-html-' npm ERR ! A complete log of this run can be found in : npm ERR ! C : \Users\lenovo\AppData\Roaming\npm - cache\_logs\ 2020 - 12 - 14 T13_40_02_550Z - debug . log ERROR command failed : npm install -- loglevel error 解决办法: 注意:以管理员身份运行cmd,输入下面的指令。 1.清除缓存 npm cache clean --force 2.重新安装 npm install 然后再重新创建项目即可。 看完如果对你有帮助,感谢点赞支持! 如果你是电脑端

修改NPM全局模式默认安装路径和npm镜像源如何设置

余生长醉 提交于 2020-12-16 12:12:18
修改NPM全局模式默认安装路径和npm镜像源如何设置 ================================================ 一 、修改NPM全局模式默认安装路径的步骤 第一步执行 npm config ls :查看npm当前默认路径 一般会在(c盘) 第二步 在要更改的目录下新建两个文件夹,分别是:node_global_modules 和 node_cach 如图 第三步打开命令提示符,执行下面两条命令: "npm config set prefix "D:\Node.JS\node_global" "npm config set cache "D:\Node.JS\node_cache" 注:执行后没有没任何信息 出错会报错 如图 执行成功后,可以用 npm config ls 命令查看配置的结果,效果如图: 第四步最重要 验证配置成功后,需要***配置环境变量*** 如图: 第五步检查 是否修改成功 安装全局cnpm 执行 npm install -g cnpm --registry = https://registry.npm.taobao.org (国内淘宝镜像) 执行完后在node_goldal文件中会出现cnpm的相关文件。 结果如图: 二、npm镜像源如何设置 方法/步骤 按win+r, 输入cmd,打开dos命令。 输入 npm get

node.js操作

北城余情 提交于 2020-12-16 12:05:21
修改npm的全局安装路径 一般情况下,我们安装Node.js环境,程序会自动把NPM全局模块的路径设置在系统盘(通常是C盘下),我们在项目开发阶段不建议全局路径设置在系统盘,不但会影响电脑的性能,而且还很不安全。可以通过以下命令来设置默认下载的全局路径目录: 1 第一步:输入命令,查看当前的配置 npm config ls 初始运行结果为 2 第二步:输入命令,修改npm默认安装路径 npm config set prefix "D:\nodejs\node_global" 安装路径为自己自己所创的路径 npm config set cache "D:\nodejs\node_cache" 安装路径为自己所创的路径 修改完成后的路径 第三步:检查是否成功,如果成功,要配置环境变量 点击此电脑右键,点开属性 点击高级系统设置,点击环境变量 系统变量,找到path,将D:\nodejs\node_global(自己的文件地址)加入并设置,点击确定,设置完成 第四步:安装cnpm npm install -g cnpm --registry=https://registry.npm.taobao.org 安装完成后在执行一次代码,查看是否设置成功 npm config ls 设置完成 把默认源设置为淘宝镜像的方法 输入以下代码 npm config set registry=https:

axios

て烟熏妆下的殇ゞ 提交于 2020-12-16 11:29:07
使用axios中碰到的问题, 比如怎么写header,怎么添加authentication, config中放什么内容,https request会报error unable to verify the first certificate…… 参考了 https://www.npmjs.com/package/axios 有基本使用方法,这也是一种学习方法,用到某个nodejs package,就到npm上面搜索,都有guideline。 https://www.jianshu.com/p/e23918190912 有更详细的使用教程。 https request会报error unable to verify the first certificate, 解决方法如下:加一个httpsAgent const ax = axios.create({ baseURL:xxxxxxxxx, httpsAgent: new https.Agent({ keepAlive: true,rejectUnauthorized: false }) }); headers 需要config多个fields,下面两种写法都可以 ax.defaults.headers.common={}; //必须先置空,因为是全局默认配置,如果有多个axios request,配置值会混到一起 ax

NPM run build failed to compile - cannot get to build reactjs project

时光毁灭记忆、已成空白 提交于 2020-12-15 03:44:58
问题 Have spent last 3 hours trying to get my reactjs project to build... have removed package.json / node-modules, rebuild using npm install. Had to rebuild all my scss links for some reason, finally have development server running fine, but when i run NPM RUN BUILD i get the following error... > react-scripts build Creating an optimized production build... Failed to compile. Parse error on line 1: ^ Expecting "CALC", "LPAREN", "SUB", "NUMBER", "FUNCTION", "LENGTH", "ANGLE", "TIME", "FREQ", "RES"

以太坊开发去中心化投票DApp与智能合约实例

时间秒杀一切 提交于 2020-12-13 19:38:26
在整个加密货币市场的市值超过7000亿美元之后,加密货币市场在过去几个月太疯狂了,但这只是一个开始。随着区块链系统的不断发展和扩展,进入这一新领域并利用这项技术的一个好方法是使用去中心化应用程序,也称为dApps。 CryptoKitties 以其使以太坊区块链拥挤而闻名,是dApp的一个很好的例子,它将可养殖和可收藏的概念与区块链相结合。这个耸人听闻的游戏只是一个创造性的例子,几乎有无限的机会。 虽然看似非常复杂,但已经开发出某些框架和工具来抽象你与区块链和智能合约的交互。在这篇博文中,我将通过一种方式在以太坊上创建一个去中心化的投票应用程序。我将简要介绍以太坊,但你可能应该对它有所了解,以便充分利用本指南。另外,我希望你知道Javascript。 为什么要开发去中心化投票应用? 从本质上讲,利用区块链技术的去中心化应用程序允许你在没有可信赖的第三方的情况下执行与今天相同的操作(如转移资金)。最好的dApp具有特定的真实世界的用例,以便利用区块链的独特特征。 从本质上讲,区块链是一个共享的,可编程的,加密安全的,可信赖的分类账本,没有任何一个用户可以控制,任何人都可以查询。- Klaus Schwab 即使投票应用对大家来说可能不是一个伟大的应用程序,但是我选择使用它作为本指南,这是因为区块链解决的主要问题:透明度,安全性,可访问性,可信任,是困扰当前民主选举的主要问题。

Error with 'import' statement without .js extension using npm module with Laravel Mix

夙愿已清 提交于 2020-12-12 12:14:26
问题 I'm using CKEditor 5 in a Laravel project, getting it from a CDN, so initially I have not needed to run npm. But now I need an alignment plugin, so I used Laravel Mix to run npm install, and then copy the plugin to public folder. Like this: mix.copyDirectory('node_modules/@ckeditor', 'public/@ckeditor'); In my code, I tried to import it: import Alignment from '/@ckeditor/ckeditor5-alignment/src/alignment.js'; So it threw this error in console Uncaught TypeError: Failed to resolve module

Warning: Functions are not valid as a React child. (React-native )

你。 提交于 2020-12-12 09:18:13
问题 I am receiving the error: Warning: Functions are not valid as a React child. I am writing a React Native application. interface RegisterScreenProps { navigation: NavigationContainerRef; } const RegisterScreen: FunctionComponent<RegisterScreenProps> = ({ navigation, }: RegisterScreenProps) => { const { container, headerLogo, headerTitle, body } = styles; return ( <SafeAreaView style={{ flex: 1 }}> <KeyboardAwareScrollView style={styles.container}> <View> <TextInput value={

Warning: Functions are not valid as a React child. (React-native )

走远了吗. 提交于 2020-12-12 09:16:33
问题 I am receiving the error: Warning: Functions are not valid as a React child. I am writing a React Native application. interface RegisterScreenProps { navigation: NavigationContainerRef; } const RegisterScreen: FunctionComponent<RegisterScreenProps> = ({ navigation, }: RegisterScreenProps) => { const { container, headerLogo, headerTitle, body } = styles; return ( <SafeAreaView style={{ flex: 1 }}> <KeyboardAwareScrollView style={styles.container}> <View> <TextInput value={

Vue环境搭建

元气小坏坏 提交于 2020-12-12 07:15:36
1、下载node.js,地址:http://nodejs.cn,安装完成后在cmd中查看是否已安装成功:node -v 2、安装淘宝npm镜像:npm install -g cnpm --registry=https://registry.npm.taobao.org,安装过程中如果发生如下警告信息 npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0 C:\Users\Administrator\AppData\Roaming\npm\cnpm -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\bin\cnpm + cnpm@6.0.0 added 679 packages from 898 contributors in 38.097s 可以尝试如下操作: cnpm install cnpm@ 6.0 . 0 使用cnpm -v 命令查看一下是否安装成功,如下图: 3、下面安装vue-cli脚手架,输入命令