最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - npm ERR! semver.simplifyRange is not a function - Stack Overflow

programmeradmin2浏览0评论

Trying to follow the Express getting started tutorial.

I generated an app and ran npm install following the provided instructions.

> npx express-generator --view=pug myapp
> npm install
npm ERR! semver.simplifyRange is not a function
npm ERR! A plete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2021-03-21T04_58_39_577Z-debug.log

The relevant portion from the log

555 http fetch GET 200 .0.1.tgz 706ms
556 timing reifyNode:node_modules/longest Completed in 751ms
557 timing metavuln:cache:get:security-advisory:transformers:qlM2fO34VL+rWNeim/6QsbBJFfHtRf4Z7FAoL1JLqVXlvg5FMRxw1WstcKR09WDDJCiJsPPrdRJugEOTZ6eGZA== Completed in 22ms
558 verbose stack TypeError: semver.simplifyRange is not a function
558 verbose stack     at Advisory.[calculateRange] (/usr/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js:191:16)
558 verbose stack     at Advisory.load (/usr/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js:148:28)
558 verbose stack     at Calculator.[calculate] (/usr/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js:59:14)
558 verbose stack     at async Promise.all (index 0)
558 verbose stack     at async Map.[init] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:177:7)
558 verbose stack     at async Map.run (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:105:7)

New to node and I have no idea what this means. Looks to be a problem with npm and not Express?

I tried running npm cache clean --force and deleting node_modules but neither helped.

If it is relevant, npm version 7.6.3 and node version 15.11.0.

Trying to follow the Express getting started tutorial.

I generated an app and ran npm install following the provided instructions.

> npx express-generator --view=pug myapp
> npm install
npm ERR! semver.simplifyRange is not a function
npm ERR! A plete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2021-03-21T04_58_39_577Z-debug.log

The relevant portion from the log

555 http fetch GET 200 https://registry.npmjs/longest/-/longest-1.0.1.tgz 706ms
556 timing reifyNode:node_modules/longest Completed in 751ms
557 timing metavuln:cache:get:security-advisory:transformers:qlM2fO34VL+rWNeim/6QsbBJFfHtRf4Z7FAoL1JLqVXlvg5FMRxw1WstcKR09WDDJCiJsPPrdRJugEOTZ6eGZA== Completed in 22ms
558 verbose stack TypeError: semver.simplifyRange is not a function
558 verbose stack     at Advisory.[calculateRange] (/usr/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js:191:16)
558 verbose stack     at Advisory.load (/usr/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/advisory.js:148:28)
558 verbose stack     at Calculator.[calculate] (/usr/lib/node_modules/npm/node_modules/@npmcli/metavuln-calculator/lib/index.js:59:14)
558 verbose stack     at async Promise.all (index 0)
558 verbose stack     at async Map.[init] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:177:7)
558 verbose stack     at async Map.run (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:105:7)

New to node and I have no idea what this means. Looks to be a problem with npm and not Express?

I tried running npm cache clean --force and deleting node_modules but neither helped.

If it is relevant, npm version 7.6.3 and node version 15.11.0.

Share Improve this question edited Mar 21, 2021 at 23:37 asked Mar 21, 2021 at 5:05 user9614249user9614249 1
  • 1 I get the same error trying to: - init a react-native project with npx. npx init react-native myProject - installing react-native globally with npm install -g react-native I have the same version of npm and node – Antenaina Commented Mar 23, 2021 at 8:21
Add a ment  | 

1 Answer 1

Reset to default 7

My solution was to install older version of semver and update npm itself to version 7.7.0. I used the mands:

sudo npm install -g [email protected]

and then

sudo npm install -g [email protected]

After it worked

发布评论

评论列表(0)

  1. 暂无评论