npm install 编译失败 cnpm install编译正常 报错 Maximum call stack size exceeded

背景

项目 使用npm install 报错 控制台信息如下

npm ERR! Maximum call stack size exceeded

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\john\AppData\Roaming\npm-cache\_logs\2020-12-09T01_46_15_301Z-debug.log

详细日志信息
0 info it worked if it ends with ok
1 verbose cli [ 'D:\\Develop\\nodejs\\node.exe',
1 verbose cli   'D:\\Develop\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 8ce5a6cf24111825
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall [email protected]
7 info lifecycle [email protected]~preinstall: [email protected]
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 timing stage:loadCurrentTree Completed in 6945ms
11 silly install loadIdealTree
12 silly install cloneCurrentTreeToIdealTree
13 timing stage:loadIdealTree:cloneCurrentTree Completed in 84ms
14 silly install loadShrinkwrap
15 verbose stack RangeError: Maximum call stack size exceeded
15 verbose stack     at RegExp.test ()
15 verbose stack     at schemas.forEach.schema (D:\Develop\nodejs\node_modules\npm\node_modules\aproba\index.js:39:16)
15 verbose stack     at Array.forEach ()
15 verbose stack     at validate (D:\Develop\nodejs\node_modules\npm\node_modules\aproba\index.js:34:11)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:37:3)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:39:14)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:39:14)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:39:14)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:39:14)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:39:14)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:39:14)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:39:14)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:39:14)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:39:14)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:39:14)
15 verbose stack     at flatNameFromTree (D:\Develop\nodejs\node_modules\npm\lib\install\flatten-tree.js:39:14)
16 verbose cwd F:\code\work\xueba\frontend\admin
17 verbose Windows_NT 6.3.9600
18 verbose argv "D:\\Develop\\nodejs\\node.exe" "D:\\Develop\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
19 verbose node v10.15.3
20 verbose npm  v6.11.2
21 error Maximum call stack size exceeded
22 verbose exit [ 1, true ]


而使用cnpm install 进行编译发现可以正常使用
日志如下:

| [27/36] Installing path-parse@^1.0.6platform unsupported @vue/[email protected][email protected][email protected][email protected] › fsevents@~2.1.2 Package require os(darwin) not compatible with your platform(win32)
/ [27/36] Installing path-parse@^1.0.6[fsevents@~2.1.2] optional install error: Package require os(darwin) not compatible with your platform(win32)
√ Installed 36 packages
√ Linked 288 latest versions
√ Run 0 scripts
peerDependencies link @babel/[email protected] in F:\code\work\xueba\frontend\admin\node_modules\[email protected]@babel-loader unmet with F:\code\work\xueba\frontend\admin\node_modules\@babel\core(7.10.2)
peerDependencies link [email protected] in F:\code\work\xueba\frontend\admin\node_modules\[email protected]@babel-loader unmet with F:\code\work\xueba\frontend\admin\node_modules\webpack(4.43.0)
peerDependencies link [email protected] in F:\code\work\xueba\frontend\admin\node_modules\[email protected]@ajv-keywords unmet with F:\code\work\xueba\frontend\admin\node_modules\ajv(6.12.2)
peerDependencies link [email protected] in F:\code\work\xueba\frontend\admin\node_modules\_@[email protected]@@vue\preload-webpack-plugin unmet with F:\code\work\xueba\frontend\admin\node_modules\webpack(4.43.0)
peerDependencies link [email protected] in F:\code\work\xueba\frontend\admin\node_modules\_@[email protected]@@chenfengyuan\vue-qrcode unmet with F:\code\work\xueba\frontend\admin\node_modules\vue(2.6.11)
peerDependencies link [email protected] in F:\code\work\xueba\frontend\admin\node_modules\_@[email protected]@@riophae\vue-treeselect unmet with F:\code\work\xueba\frontend\admin\node_modules\vue(2.6.11)
peerDependencies link [email protected] in F:\code\work\xueba\frontend\admin\node_modules\[email protected]@terser-webpack-plugin unmet with F:\code\work\xueba\frontend\admin\node_modules\webpack(4.43.0)
peerDependencies link [email protected] in F:\code\work\xueba\frontend\admin\node_modules\[email protected]@mini-css-extract-plugin unmet with F:\code\work\xueba\frontend\admin\node_modules\webpack(4.43.0)
peerDependencies link [email protected] in F:\code\work\xueba\frontend\admin\node_modules\[email protected]@vue-loader unmet with F:\code\work\xueba\frontend\admin\node_modules\webpack(4.43.0)
peerDependencies link [email protected] in F:\code\work\xueba\frontend\admin\node_modules\_@[email protected]@@vue\cli-service unmet with F:\code\work\xueba\frontend\admin\node_modules\vue-template-compiler(2.6.11)
peerDependencies link [email protected] in F:\code\work\xueba\frontend\admin\node_modules\[email protected]@element-ui unmet with F:\code\work\xueba\frontend\admin\node_modules\vue(2.6.11)
Recently updated (since 2020-12-02): 5 packages (detail see file F:\code\work\xueba\frontend\admin\node_modules\.recently_updates.txt)
  Today:
    → @vue/[email protected][email protected] › electron-to-chromium@^1.3.612(1.3.620) (03:02:40)
√ All packages installed (168 packages installed from npm registry, used 44s(network 44s), speed 331.16kB/s, json 307(1.22MB), tarball 12.87MB)

F:\code\work\xueba\frontend\admin>npm run dev

> [email protected] dev F:\code\work\xueba\frontend\admin
> vue-cli-service serve

 INFO  Starting development server...
 10% building 2/2 modules 0 activei 「wds」: Project is running at http://localhost:8080/
i 「wds」: webpack output is served from /
i 「wds」: Content not from webpack is served from F:\code\work\xueba\frontend\admin\public
i 「wds」: 404s will fallback to /index.html
 13% building 25/28 modules 3 active ...dev-server\client\clients\BaseClient.jsBrowserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
 98% after emitting CopyPlugin

 WARNING  Compiled with 2 warnings                                                                                                                                                                                             09:59:13


 warning  in ./src/views/rate/testing/index.vue?vue&type=template&id=6036aebe&scoped=true&

Module Warning (from ./node_modules/[email protected]@vue-loader/lib/loaders/templateLoader.js):
(Emitted value instead of an instance of Error) : component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.

 @ ./src/views/rate/testing/index.vue?vue&type=template&id=6036aebe&scoped=true& 1:0-524 1:0-524
 @ ./src/views/rate/testing/index.vue
 @ ./src sync ^\.\/.*\.vue$
 @ ./src/router/avue-router.js
 @ ./src/router/router.js
 @ ./src/main.js
 @ multi ./node_modules/[email protected]@webpack-dev-server/client?http://192.168.1.118:8080/sockjs-node ./node_modules/[email protected]@webpack/hot/dev-server.js ./src/main.js babel-polyfill classlist-polyfill

 warning  in ./src/views/rate/authentication/index.vue?vue&type=template&id=00f4cea0&scoped=true&

Module Warning (from ./node_modules/[email protected]@vue-loader/lib/loaders/templateLoader.js):
(Emitted value instead of an instance of Error) : component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.

 @ ./src/views/rate/authentication/index.vue?vue&type=template&id=00f4cea0&scoped=true& 1:0-524 1:0-524
 @ ./src/views/rate/authentication/index.vue
 @ ./src sync ^\.\/.*\.vue$
 @ ./src/router/avue-router.js
 @ ./src/router/router.js
 @ ./src/main.js
 @ multi ./node_modules/[email protected]@webpack-dev-server/client?http://192.168.1.118:8080/sockjs-node ./node_modules/[email protected]@webpack/hot/dev-server.js ./src/main.js babel-polyfill classlist-polyfill


  App running at:
  - Local:   http://localhost:8080/
  - Network: http://192.168.1.118:8080/

  Note that the development build is not optimized.
  To create a production build, run npm run build.


简介

npm(node package manager):nodejs的包管理器,用于node插件管理(包括安装、卸载、管理依赖等)
cnpm:因为npm安装插件是从国外服务器下载,受网络的影响比较大,可能会出现异常,如果npm的服务器在中国就好了,所以我们乐于分享的淘宝团队干了这事。来自官网:“这是一个完整 npmjs.org 镜像,你可以用此代替官方版本(只读),同步频率目前为 10分钟 一次以保证尽量与官方服务同步。”

详细区别见参考链接

参考链接

npm 和 cnpm 的区别,你真的搞懂了嘛

NPM 使用介绍

你可能感兴趣的:(奇淫技巧,npm,node.js)