【问题标题】:TypeError: parse is not a functionTypeError:解析不是函数
【发布时间】:2021-07-13 01:21:57
【问题描述】:

由于我已将 Font Awesome 依赖项安装到我的应用程序并尝试在测试后立即运行npm start,我收到了此error,它非常残酷且难以解决。

$ npm start

> portfolio@0.1.3 start
> react-scripts start

~/Documents/GitHub/REACT/Portfolio/Portfolio/node_modules/css-select/lib/compile.js:31
        var token = parse(selector, options);
                    ^

TypeError: parse is not a function
    at compileUnsafe (~/Documents/GitHub/REACT/Portfolio/Portfolio/node_modules/css-select/lib/compile.js:31:14)
    at Function.compile (~/Documents/GitHub/REACT/Portfolio/Portfolio/node_modules/css-select/lib/compile.js:20:13)
    at new Selector (~/Documents/GitHub/REACT/Portfolio/Portfolio/node_modules/renderkid/lib/renderKid/styles/rule/Selector.js:13:26)
    at new Rule (~/Documents/GitHub/REACT/Portfolio/Portfolio/node_modules/renderkid/lib/renderKid/styles/Rule.js:10:21)
    at StyleSheet.module.exports.StyleSheet._setSingleRule (~/Documents/GitHub/REACT/Portfolio/Portfolio/node_modules/renderkid/lib/renderKid/styles/StyleSheet.js:42:14)
    at StyleSheet.module.exports.StyleSheet._setRule (~/Documents/GitHub/REACT/Portfolio/Portfolio/node_modules/renderkid/lib/renderKid/styles/StyleSheet.js:33:12)
    at StyleSheet.module.exports.StyleSheet.setRule (~/Documents/GitHub/REACT/Portfolio/Portfolio/node_modules/renderkid/lib/renderKid/styles/StyleSheet.js:22:14)
    at Styles.module.exports.Styles._setDefaultStyles (~/Documents/GitHub/REACT/Portfolio/Portfolio/node_modules/renderkid/lib/renderKid/Styles.js:34:25)
    at new Styles (~/Documents/GitHub/REACT/Portfolio/Portfolio/node_modules/renderkid/lib/renderKid/Styles.js:30:10)
    at RenderKid.module.exports.RenderKid._initStyles (~/Documents/GitHub/REACT/Portfolio/Portfolio/node_modules/renderkid/lib/RenderKid.js:53:27)

我检查了我的package.json 文件并正确分配了我的启动脚本。我已经为这个错误困扰了将近一天了。

我还检查了我的所有依赖项,以确保它们没有过时。一切都是最新的,而且似乎仍在获取error

我什至试图从我的提交中恢复几步,但不幸的是仍然遇到这个error,所以我相信它必须与modules有关

【问题讨论】:

  • @thgaskell 如何从路径中删除user 文本,我觉得这可能是在我尝试更新我的local nodejs 文件夹后发生的。
  • 我只是出于显示目的从终端输出中删除了它。但这与您遇到的问题无关。看起来这是您的依赖项的问题。我会尝试删除您的 node_modules 文件夹并重新安装。如果您自上次运行项目后更新了node,这可能与哪个有关?
  • 是的,你是对的。我刚刚尝试在另一个项目上运行npm start,它运行得非常好。将在我的项目中重新初始化 node_modules。谢谢楼主

标签: node.js npm terminal


【解决方案1】:

尝试使用较旧的稳定版本而不是新版本。 它对我有用.. 我更改了 packet.json 中的版本并删除了 node_module 文件夹和 然后再次使用 npm install

【讨论】:

    猜你喜欢
    • 2023-03-12
    • 2021-11-17
    • 2021-06-21
    • 2020-06-29
    • 2020-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-03
    相关资源
    最近更新 更多