如何修复错误 npm ERR!意外的标记 '。'当使用 npm install 时

问题描述 投票:0回答:1

当我在react-native项目中使用npm install时,使用expo然后出现错误enter image description here

我的项目有一些包必须使用节点> 18。这是我的package.json enter image description here

我尝试运行 npm install which node < 16 then have not Unexpected token '.' but some package doesn't install. So I can run project.

我也尝试删除节点模块并重试但不行 我也尝试 npm install -g npm@latest 但不行 全部用npm都不行 我想当使用节点 >= 18 时可以运行 npm install 帮帮我:((((

javascript
1个回答
0
投票

我想我需要更多关于您在终端中使用的

node version
的信息。为了处理不同的节点版本,我真的建议尝试
nvm
https://github.com/nvm-sh/nvm)。

话虽这么说,看看 Github Issues 上的评论,它可能对你有用 https://github.com/npm/cli/issues/4234#issuecomment-1025421643

他们将节点版本设置为

16.13.2

© www.soinside.com 2019 - 2024. All rights reserved.