npm安装报错解决合集(一)
在新版nodejs已经集成了npm,所以npm也都安装好了。可以通过输入下面命令来测试是否成功安装
node -vnpm -v
如果安装成功,都会出现版本号
用npm -v测试,报错:
node:internal/modules/cjs/loader:936throw err;^Error: Cannot find module 'D:lcbsoftware
odejs
ode_modules
pmin
pm-cli.js'at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)at Function.Module._load (node:internal/modules/cjs/loader:778:27)at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)at node:internal/main/run_main_module:17:47 {code: 'MODULE_NOT_FOUND',requireStack: []
}
node:internal/modules/cjs/loader:936throw err;^Error: Cannot find module 'D:lcbsoftware
odejs
ode_modules
pmin
pm-cli.js'
[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)[39m
[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)[39m
[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)[39m
[90m at node:internal/main/run_main_module:17:47[39m {code: [32m'MODULE_NOT_FOUND'[39m,requireStack: []
}
解决办法:
1.卸载重装
2.以管理员方式运行
配好npm之后,在项目中报错,
输入安装依赖命令
npm install
报错如下:
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:Program Files
odejs
ode_cache_cacache mpcc62b2b3
npm ERR! errno EPERM
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/@riophae%2fvue-treeselect: EPERM: operation not permitted, open 'C:Program Files
odejs
ode_ca
che_cacache mpcc62b2b3'
npm ERR! at C:Program Files
odejs
ode_modules
pm
ode_modulesminipass-fetchlibody.js:162:15
npm ERR! at async Arborist.[nodeFromEdge] (C:Program Files
odejs
ode_modules
pm
ode_modules@npmcliarboristlibarboristuild-ideal-tree.js:1061:19)
npm ERR! at async Arborist.[buildDepStep] (C:Program Files
odejs
ode_modules
pm
ode_modules@npmcliarboristlibarboristuild-ideal-tree.js:930:11)
npm ERR! at async Arborist.buildIdealTree (C:Program Files
odejs
ode_modules
pm
ode_modules@npmcliarboristlibarboristuild-ideal-tree.js:216:7)
npm ERR! at async Promise.all (index 1)
npm ERR! at async Arborist.reify (C:Program Files
odejs
ode_modules
pm
ode_modules@npmcliarboristlibarborist
eify.js:149:5)
npm ERR! at async Install.install (C:Program Files
odejs
ode_modules
pmlibinstall.js:170:5)
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/@riophae%2fvue-treeselect: EPERM: operation not permitted, open 'C:Program Files
odejs
ode_c
ache_cacache mpcc62b2b3'
npm ERR! at C:Program Files
odejs
ode_modules
pm
ode_modulesminipass-fetchlibody.js:162:15
npm ERR! at async Arborist.[nodeFromEdge] (C:Program Files
odejs
ode_modules
pm
ode_modules@npmcliarboristlibarboristuild-ideal-tree.js:1061:19)
npm ERR! at async Arborist.[buildDepStep] (C:Program Files
odejs
ode_modules
pm
ode_modules@npmcliarboristlibarboristuild-ideal-tree.js:930:11)
npm ERR! at async Arborist.buildIdealTree (C:Program Files
odejs
ode_modules
pm
ode_modules@npmcliarboristlibarboristuild-ideal-tree.js:216:7)
npm ERR! at async Promise.all (index 1)
npm ERR! at async Arborist.reify (C:Program Files
odejs
ode_modules
pm
ode_modules@npmcliarboristlibarborist
eify.js:149:5)
npm ERR! at async Install.install (C:Program Files
odejs
ode_modules
pmlibinstall.js:170:5) {
npm ERR! code: 'EPERM',
npm ERR! errno: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\Program Files
odejs
ode_cache_cacache\tmp\cc62b2b3’,
npm ERR! type: ‘system’,
npm ERR! requiredBy: ‘.’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It’s possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
解决办法:
删除npmrc文件,需要注意的是:不是nodejs安装目录npm模块下的那个npmrc文件,而是在C:Users{账户}下的.npmrc文件.
继续安装依赖:
npm install
出现下面结果:
npm WARN ERESOLVE overriding peer dependency
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated microargs@1.1.2: This project has been renamed to @pawelgalazka/cli-args. Install using @pawelgalazka/cli-args instead
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.de
v/blog/math-random for details.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated microcli@1.3.3: This project has been renamed to @pawelgalazka/cli . Install using @pawelgalazka/cli instead
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated runjs@4.4.2: This project has been renamed to 'tasksfile'. Install using 'npm install tasksfile' instead.
npm WARN deprecated highlight.js@9.18.5: Support has ended for 9.x series. Upgrade to @latest
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in oldcore-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated html-webpack-plugin@3.2.0: 3.x is no longer supported
npm WARN deprecated eslint-loader@2.2.1: This loader has been deprecated. Please use eslint-webpack-plugin
npm WARN deprecated html-webpack-plugin@3.2.0: 3.x is no longer supportedadded 1568 packages, and audited 1569 packages in 3m105 packages are looking for fundingrun `npm fund` for details37 vulnerabilities (23 moderate, 11 high, 3 critical)To address issues that do not require attention, run:npm audit fixTo address all issues possible (including breaking changes), run:npm audit fix --forceSome issues need review, and may require choosing
a different dependency.Run `npm audit` for details.
npm notice
npm notice New minor version of npm available! 8.1.2 -> 8.3.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.3.0
npm notice Run npm install -g npm@8.3.0 to update!
npm notice
原因:默认的安装源是国外网站,国内访问不了无法获取依赖包信息。
解决办法:添加
npm config set registry http://registry.npm.taobao.org/
其他常见命令:
# 查看自己的安装源
npm config get registry# 更换npm源为国内淘宝镜像
npm config set registry http://registry.npm.taobao.org/# 或者更换为国内npm官方镜像
npm config set registry http://registry.cnpmjs.org/# 还原npm源
npm config set registry https://registry.npmjs.org/
继续执行:
npm install
结果如下:
up to date in 2s105 packages are looking for fundingrun `npm fund` for details
即安装完成。
npm启动项目命令
npm run dev
npm安装报错解决合集(一)相关推荐
- npm install 报错问题解决合集
很多时候安装npm install 的时候并不能直接将当前的node_modules直接一键安装到本地. 总是会出现各种各样的报错 常见的有以下多种情况 tip1:本地node 跟npm 版本不匹配, ...
- C++:报错解决合集
1.VS2015报错:严重性 代码 说明 项目 文件 行 禁止显示状态 错误 C4996 'strcpy': This function or variable may be unsafe. Cons ...
- 【npm i 报错解决方法】npm ERR! code ERESOLVEnpm ERR!npm ERR! While resolving: by-web@1.2.2npm ERR!
[npm i 报错解决方法]npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! np ...
- npm -4048报错解决
*关于在拉取代码之后安装依赖时出现-4048的报错 ** 在我们git clone url拉取代码,使用npm i 安装依赖包的时候有时候会出现-4048的问题如下图, 此图为npm i 报错 解决方 ...
- 【微信小程序】报错信息合集
小程序报错信息合集
- Apache2.4.1编译安装报错解决
Apache HTTP Server(HTTPD)2.4.1,这个版本是新一代的2.4分支的首个正式版本. Apache HTTP Server项目团队称,这是最新的.也是最好的一个版本,添加了许多新 ...
- Navicat Premium15 安装报错解决办法
Navicat Premium15 安装报错解决办法 在安装Navicat的时候,发现一直无法破解安装,一直报错提示"激活失败.原因可能是由于已达到激活次数的上限.请检查你是否已在 卸载或重 ...
- 【转载】Chrome插件在高版本浏览器中安装报错解决
为什么80%的码农都做不了架构师?>>> Chrome插件在高版本浏览器中安装报错解决技术 maybe yes 发表于2014-12-17 17:20 原文链接 : http: ...
- npm安装报错Error: EPERM: operation not permitted解决方案
电脑重装系统后重新配置环境安装node后,npm命令安装报错 Error: EPERM: operation not permitted npm ERR! code EPERM npm ERR! sy ...
最新文章
- 2022-2028年中国降解塑料聚酯行业运行动态及投资机会分析报告
- TCP/IP详解--第四章
- 深入理解ajax系列第五篇——进度事件
- S3c2440A WINCE平台HIVE注册表+binfs的实现
- 【论文解读】PFLD:高精度实时人脸关键点检测算法
- 联想打印机7256显示更换墨盒_惠普打印机涉嫌垄断?只认自家“昂贵”墨盒,成本太高招架不住...
- Kaggle-泰坦尼克号
- redis持久化功能
- 国外程序猿整理的C++大全
- stm32c语言long型数据多少位,stm32 C语言的数据类型说明
- ASP.NET2.0(学习第一天)
- 入门嵌入式HTML/CSS/脚本引擎 sciter
- fastboot 刷入第三方 Recovery——Android 安装 Xposed 框架那点事
- Python——付费/版权歌曲下载
- 海康sdk远程门禁_海康威视远程监控Android端SDK调用示例
- 单元测试1-为什么需要单元测试
- lf模型下声门脉冲matlab程序,数字语音处理及MATLAB仿真.rar第二章
- E - Max Min(尺取(线性时间找包含两个数的区间有多少))
- 百胜erp软件下载 php,百胜erp软件迎来电商软件3.0时代
- hexo主题切换可能出现的错误
热门文章
- Linux usb子系统 _usb-skeleton.c精析
- python二维字典简单赋值取值
- simcomm卖给新博通
- Largest Rectangle in a Histogram HDU - 1506 解题思路 单调栈
- enumeration value 'xxxxx' not handled in switch警告
- linux 安装配置java环境 jdk1.6 jdk-6u45-linux-x64.bin
- 阅读感想——《富爸爸穷爸爸》
- 2017年2月12日GRE考试报名费用公布
- 网站被黑,通过百度/搜狗等搜索关键词访问跳转到其他网站怎么办?
- Android 音频(Audio)架构