首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >未安装节点模块

未安装节点模块
EN

Stack Overflow用户
提问于 2021-03-11 04:43:04
回答 1查看 165关注 0票数 0

我从我的组织tfs获得了最新的项目代码。我做了一个npm install,但是由于下面的错误,它失败了。

代码语言:javascript
运行
复制
PS C:\Repo\source_code_2\xxx> npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: xxx@0.0.1
npm ERR! Found: typescript@2.7.2
npm ERR! node_modules/typescript
npm ERR!   dev typescript@"2.7.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer typescript@">=2.4.2 <2.7" from @angular/compiler-cli@5.2.10
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   @angular/compiler-cli@"5.2.10" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\username\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\username\AppData\Local\npm-cache\_logs\2021-03-09T15_02_32_661Z-debug.log
PS C:\Repo\source_code_2\xxx> 

是什么引起了这个问题?这不会发生在我同事的电脑上。

这里是我的节点信息

代码语言:javascript
运行
复制
PS C:\Repo\source_code_2\xxx> npm -v
7.6.1
PS C:\Repo\source_code_2\xxx> node -v
v14.16.0
PS C:\Repo\source_code_2\xxx> npm info
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/xxx - Not found
npm ERR! 404
npm ERR! 404  'xxx@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\username\AppData\Local\npm-cache\_logs\2021-03-09T14_45_17_253Z-debug.log
PS C:\Repo\source_code_2\xxx>

更新#1,而不是检查npm install失败的原因。我登录到tfs到项目位置,下载了node_modules并粘贴到本地项目中。之后,我运行了npm rebuild node-sassnpm run sim (配置为使用模拟器api服务运行)。仍然无法运行应用程序。

代码语言:javascript
运行
复制
C:\Repo\source_code_2\xxx>npm run sim

> xxx@0.0.1 sim
> cross-env-shell NODE_ENV=simulator "npm run _runStandalone"


> xxx@0.0.1 _runStandalone
> npm run _authenticateLocal && webpack-dev-server --config webpack.ng.js


> xxx@0.0.1 _authenticateLocal
> node ./scripts/serve-before.js

CONFIGURING AUTHENTICATION FOR STANDALONE APP.  ENVIRONMENT: simulator
[PROXY] Proxying all WAS requests to http://localhost:44309/
 10% building modules 3/3 modules 0 active[HPM] Proxy created: /remoteWAS  ->  http://localhost:44309/
[HPM] Proxy rewrite rule created: "^/remoteWAS" ~> ""
Project is running at http://localhost:4200/
webpack output is served from /
404s will fallback to /index.html
 11% building modules 13/17 modules 4 active ...d\node_modules\webpack\hot\emitter.jswebpack: wait until bundle finished: /
Hash: 4b285717fb0b3db6f17e
Version: webpack 3.11.0
Time: 19417ms
 25 assets
   [0] multi (webpack)-dev-server/client?http://localhost:4200 ./src/app/main.ts 40 bytes {main} [built]
   [1] multi (webpack)-dev-server/client?http://localhost:4200 ./src/polyfills.ts 40 bytes {polyfills} [built]
   [2] multi (webpack)-dev-server/client?http://localhost:4200 ./src/app/app.scss ./node_modules/@wfm/web-theme/font/ge-icon.css ./node_modules/primeng/resources/primeng.css 64 bytes {styles} [built]
[./node_modules/@wfm/web-theme/font/ge-icon.css] ./node_modules/@wfm/web-theme/font/ge-icon.css 1.13 kB {styles} [built]
[./node_modules/loglevel/lib/loglevel.js] ./node_modules/loglevel/lib/loglevel.js 8.86 kB {inline} [built]
[./node_modules/primeng/resources/primeng.css] ./node_modules/primeng/resources/primeng.css 1.11 kB {styles} [built]
[./node_modules/raw-loader/index.js!./node_modules/postcss-loader/lib/index.js??embedded!./node_modules/@wfm/web-theme/font/ge-icon.css] ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/@wfm/web-theme/font/ge-icon.css 47.4 kB {styles} [built]
[./node_modules/raw-loader/index.js!./node_modules/postcss-loader/lib/index.js??embedded!./node_modules/primeng/resources/primeng.css] ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/primeng/resources/primeng.css 119 kB {styles} [built]
[./node_modules/raw-loader/index.js!./node_modules/postcss-loader/lib/index.js??embedded!./node_modules/sass-loader/lib/loader.js??ref--8-3!./src/app/app.scss] ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--8-3!./src/app/app.scss 566 kB {styles} [built]
[./node_modules/strip-ansi/index.js] ./node_modules/strip-ansi/index.js 161 bytes {inline} [built]
[./node_modules/style-loader/lib/addStyles.js] ./node_modules/style-loader/lib/addStyles.js 9.46 kB {styles} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost:4200] (webpack)-dev-server/client?http://localhost:4200 7.93 kB {inline} [built]
[./src/app/app.scss] ./src/app/app.scss 1.35 kB {styles} [built]
[./src/app/main.ts] ./src/app/main.ts 0 bytes {main} [built]
[./src/polyfills.ts] ./src/polyfills.ts 0 bytes {polyfills} [built]
    + 22 hidden modules

ERROR in Cannot read property 'length' of undefined
Child html-webpack-plugin for "index.html":
     1 asset
    [./node_modules/html-webpack-plugin/lib/loader.js!./src/index.html] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.html 651 bytes {0} [built]
webpack: Failed to compile.
EN

回答 1

Stack Overflow用户

发布于 2021-03-11 06:03:09

使用下面的命令。

代码语言:javascript
运行
复制
npm cache clean --force
npm init 
rm -rf node_modules
npm install
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66576592

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档