npm install 报错

安装node.js时,使用npm install时会有各种各样的问题,有时一个问题解决了,另一个问题就出来了。

个人的这些问题,1-->最后 就是按顺序发生的问题,很是无语

 

1、npm install 报 cb.apply is not a function 错

解决办法:

1、先把项目内的 package-lock.json 删除掉,要是有node_moudules 包的话一块删除
2、win + r 打开运行,输入%appdata%
3、删除 npm 和 npm-cache 文件夹
4、执行npm cache clean --force命令

此时应该可以了。

如果还不可以,就执行卸载Node.js重新安装。

如果还是不可以,就使用yarn

安装yarn 
npm install -g yarn

yarn install 代替 npm install

 

或者使用cnpm安装

个人使用的是cnpm安装

安装cnpm:
npm install cnpm -g --registry=https://registry.npm.taobao.org

用cnpm安装依赖:
cnpm install

 

2、报gyp ERR! stack Error: Can't find Python executable "D:\SystemSoftWare\Python39", you can set the PYTHON env variable.

gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "D:\SystemSoftWare\Python39", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (D:\IdeaSpace\Study\renren-fast-vue\node_modules\node-sass\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (D:\IdeaSpace\Study\renren-fast-vue\node_modules\node-sass\node_modules\node-gyp\lib\configure.js:509:16)
。。。。。。

解决办法:

  1. 安装python2.7版本,不用设置环境变量
  2. 设置Python2.7版本:npm config set python D:\SystemSoftWare\Python27
  3. 使用cnpm安装:

    安装cnpm:
    npm install cnpm -g --registry=https://registry.npm.taobao.org
    
    用cnpm安装依赖:
    cnpm install

     

3、npm run dev时报Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (83)

Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (83)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.13.1
    at module.exports (D:\IdeaSpace\Study\renren-fast-vue\node_modules\_node-sass@4.13.1@node-sass\lib\binding.js:13:13)
    at Object.<anonymous> (D:\IdeaSpace\Study\renren-fast-vue\node_modules\_node-sass@4.13.1@node-sass\lib\index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
。。。。。。

解决办法:

方法一:

        1、不用回退node版本,而是升级node-sass。

        2、update你的sass版本即可:

npm rebuild node-sass

方法二:自己手动升级:
        1、先卸载

npm uninstall --save node-sass

        2、清除缓存

npm cache clean -f

        3、升级node-sass模块

npm install --save node-sass

最后运行

npm run dev

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值