【问题标题】:npm install fails with errornpm install 失败并出现错误
【发布时间】:2021-09-27 16:17:49
【问题描述】:

我正在关注本教程enter link description here,但我在 12:41 卡住了。我通过视频描述中的链接下载了种子项目,并在 Windows 7 上以管理员身份发出了 somman npm install。但出现以下错误:

C:\development\angular2\angular2-seed>npm install

> angular2-quickstart@1.0.0 postinstall C:\development\angular2\angular2-seed
> typings install

(I translated following lines to English)
typings is not name of an command, executable or batch.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\ch
okidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.0.14: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"
})
npm WARN angular2-quickstart@1.0.0 No description
npm WARN angular2-quickstart@1.0.0 No repository field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Administrator\\A
ppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.6.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart@1.0.0 postinstall: `typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular2-quickstart@1.0.0 postinstall script 'typings ins
tall'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-quickstart p
ackage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\development\angular2\angular2-seed\npm-debug.log

请指教。谢谢。

编辑: 附件npm-debug.log:enter link description here 附件package.json:enter link description here

【问题讨论】:

  • 请附上 package.json 文件。
  • seed 项目使用 angular2 版本 "2.0.0-beta.7",它已经很老了。我建议您参考这篇快速入门文章 - angular.io/docs/ts/latest/quickstart.html
  • @ParveenSachdeva 我将 npm-debug.log 附加到我的问题中。谢谢。
  • @Sanket 谢谢你的链接。我要试试。

标签: node.js angular npm


【解决方案1】:

权限问题。它可能与 windows 中的路径名有关。

在 Git Bash 或 Windows Powershell 中检查相同的内容。

您可以像这样设置 NODE 路径:set NODE_PATH=source

删除 node_modules 并再次运行npm install

【讨论】:

  • 我以管理员身份使用 Git Bash,设置环境变量 NODE_PATH,删除了 node_modules,但不幸的是问题仍然存在。谢谢。
  • 请出示您的 package.json 文件。将有助于更轻松地调试。
  • 附加,请参阅我的问题的编辑。谢谢。
  • 您需要全局安装类型。 npm install typings --global
【解决方案2】:

如果有人在我的情况下遇到此错误并尝试了此处提到的所有解决方案,以及另一个类似的问题,例如:

  • 你在正确的目录中

  • 你有一个 package.json 文件,

  • JSON 有效,

  • 您已尝试运行 %temp%

  • 您已经尝试过“npm install -d --save”等。

我的工作是通过“npm install --force”来工作的

注意:这个错误本身也是推荐的,之前没注意。

甚至“纱线安装”也有效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-07-13
    • 1970-01-01
    • 2020-09-03
    • 2016-11-08
    • 1970-01-01
    • 1970-01-01
    • 2017-09-05
    相关资源
    最近更新 更多