未安装节点模块

时间:2021-03-11 04:43:04

标签: angular npm

我从我的组织 tfs 获得了最新的项目代码。我做了一个 npm install 但它失败并出现以下错误。

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> 

是什么导致了这个问题?我同事的电脑上没有。

这是我的节点信息

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 服务运行)。仍然无法运行应用程序

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.

1 个答案:

答案 0 :(得分:0)

使用下面的命令。

npm cache clean --force
npm init 
rm -rf node_modules
npm install
相关问题