为什么我无法运行`npm install`?

问题描述 投票:0回答:1

我正在尝试完成 Codecademy 的 Web 开发技能路径提供的一个名为“Gold Metal Metrics”的项目。目标是构建一个使用 SQLite 的 Web 应用程序。他们提供了一些起始代码,其中包含首先运行“npm install”以安装所有依赖项的指令,但我什至无法完成第一步,因为 npm 不断向我抛出错误。这是 `package.json` 文件:

{
  "name": "agoldmedalmetric",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "mocha",
    "webpack": "webpack",
    "start": "node server.js"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "webpack": "^3.5.5"
  },
  "dependencies": {
    "chai": "^4.1.2",
    "cors": "^2.8.4",
    "csv-parse": "^1.2.1",
    "express": "^4.15.4",
    "fs": "0.0.1-security",
    "mocha": "^6.1.3",
    "react-router-dom": "^4.2.2",
    "sqlite3": "^4.0.6"
  }
}

我的错误日志的一部分:

npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: This is probably built in to whatever tool you're using. If you still need it... idk
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated [email protected]: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /Users/masonbennett/Dropbox/My Mac (Mason’s MacBook Air)/Desktop/Programming/programs/github/web_apps/project-5-gold-medal-metrics-start/node_modules/sqlite3
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c
npm ERR! Failed to execute '/Users/masonbennett/.nvm/versions/node/v18.18.0/bin/node /Users/masonbennett/.nvm/versions/node/v18.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/masonbennett/Dropbox/My Mac (Mason’s MacBook Air)/Desktop/Programming/programs/github/web_apps/project-5-gold-medal-metrics-start/node_modules/sqlite3/lib/binding/node-v108-darwin-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/masonbennett/Dropbox/My Mac (Mason’s MacBook Air)/Desktop/Programming/programs/github/web_apps/project-5-gold-medal-metrics-start/node_modules/sqlite3/lib/binding/node-v108-darwin-arm64 --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok

我注意到有几条“npm WARN deprecated”消息,我认为最好的办法就是一次解决它们。但是当我尝试运行 `npm install babel-preset-env --save-dev` 来更新 `"babel-preset-es2015": "^6.24.1"` 时,我收到了相同的错误消息。我真的必须一次重新安装所有这些软件包吗?我是否必须更新所有入门 js 文件?

sqlite npm-install package.json
1个回答
0
投票

我建议首先删除 package.json 中的 ^ 字符。

该字符告诉 npm 选择每个包的最新次要版本,最好没有重大更改。

通过删除它,您应该安装作者当时拥有的版本。

如果您要一一安装它们,您将获得所有版本的最新版本,就像作者在创建它时可能所做的那样。

© www.soinside.com 2019 - 2024. All rights reserved.