• 记一次npm run test的错误解决


    好多错 套中套 千层饼
    用的npx create-react-app 创建的
    说自带jest,我就写个jest测一下,看看
    npx jest jest.test.js ok 没问题
    npx jest jest.test.js --watch 报错
    npm run test 报错
    报的是
    TypeError:fsevents is not a function 
    一开始没有定位清除
    删了项目下的node_modu
    npm install 报错  gyp 咋咋咋 完了还要装个node-sass的啥包
    百度这个问题 解决办法是
    删除全局的node-gyp
    rm -rf .node-gyp/
    全局安装
    npm install -g node-gyp
    删除全局
    rm -rf /node_modules
    重装
    npm install 
    完了还是不行 报错
    npm ERR! Maximum call stack size exceeded npm
    然后我找了一下,说是需要重装npm,过程中又 报错
    sudo npm install npm -g
    npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/chownr'
    又继续执行了一遍 发现好了
    sudo npm install npm -g
    然后试了下还是不行
    然后我又重新设置了下淘宝镜像
    npm config set registry http://registry.npm.taobao.org
    再重新装了下cnpm
    sudo npm install npm -g
    sudo cnpm install cnpm -g
    然后分别删了重装全局的node_modules和项目下的node_modules 重装 npm install
    这里终于出现了前面不一样的输出,
    然后
    npm run test ok
    npx jest jest.test.js --watch 报错
    Error: EMFILE: too many open files, watch
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:123:28)
    查了下,是个小问题影响的,无伤大雅,
    唉,我的美好星期六早上就这么过去了---
    总结:
      原因就是删除node_modules重装;
      如果还有问题就重装npm,
     
     
    —————————————— 总要有第一次的嘛~
  • 相关阅读:
    性能分析一:查看程序占用系统的内存 .
    Winform中ToolTip的用法
    30岁的程序员
    序列化
    CMD中可执行的结束进程命令
    数据库设计规范与技巧
    判断字符串编码思路
    字符串加密思路
    在同一个页面施用多个不同的jQuery版本而不冲突的方法
    mysql 数据库设计
  • 原文地址:https://www.cnblogs.com/guopeng112/p/12772145.html
Copyright © 2020-2023  润新知