我卸载了我以前版本的node.js(0.8.11)并从node.js网站下载了最新的0.10.24并安装了它.但是,在运行之后node --version,它仍然表明我正在运行v0.8.11.显然,在卸载过程中会遗留一些东西,并且在尝试通过npm添加模块时会导致各种错误.我已经看到了针对OSX和Linux的解决方案,但是找不到适合Windows的东西.我正在运行Windows 7 64位.
这是我的问题.我们有一个私有的NPM注册表,只能在VPN中使用.我想有一个后备注册表https://registry.npmjs.org,这样当我离开VPN时,它可以无缝地工作.
PS目前我正在使用npmrc,它可以很好地切换.npmrc文件作为解决方法
我是 npm 的新手,正在尝试了解重新创建node_modules部署目录的工作原理。
我们使用npm ci而不是npm install确保在部署期间干净利落。但是,当我们在没有任何标志的情况下运行它时,我们会收到以下错误:
修复上游依赖冲突,或使用 --force 或 --legacy-peer-deps 重试此命令以接受不正确(并且可能已损坏)的依赖解析。
该文件为npm install用于--force如下(有上没有国旗npm ci的页面):
-f 或 --force 参数将强制 npm 获取远程资源,即使磁盘上存在本地副本。
同时,文档--legacy-peer-deps说:
--legacy-peer-deps:安装时忽略所有 peerDependencies,采用 npm 版本 4 到版本 6 的风格。
似乎这两个标志都npm ci可以node_modules毫无问题地生成目录,但我仍然不清楚两者之间的区别。
据我了解,--force听起来它将基于最后下载的依赖项,并将覆盖任何以前下载的依赖项。同时,--legacy-peer-deps听起来它在安装过程中总是会跳过对等依赖项(无论是什么),即使没有问题。
这两个标志有什么区别,我们什么时候应该使用它们?
我目前对角度和自学还比较陌生。以前一切都工作正常,直到我决定将很多新东西导入到我的项目中。简而言之,我发现我可以删除 node_modules 并运行 npm install。删除它后,当我运行 npm install 时出现以下错误。
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: appla-katta@0.0.0
npm ERR! Found: @angular/common@12.2.16
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"~12.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^14.0.0 || ^15.0.0" from @angular/cdk@14.0.2
npm ERR! node_modules/@angular/cdk
npm ERR! @angular/cdk@"14.0.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, …Run Code Online (Sandbox Code Playgroud) 我试图添加,$ npm install react-native-touchable-bounce --save但它给出了与以下相同的错误。然后我删除了所有node_modules仍然出现此错误。
npm install给出以下错误。
PS I:\Code\singal res\code\singalRes> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react-native-svg@12.1.0
npm ERR! node_modules/react-native-svg
npm ERR! react-native-svg@"^12.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-svg@"^9.13.6" from @ui-kitten/components@5.0.0
npm ERR! node_modules/@ui-kitten/components
npm ERR! @ui-kitten/components@"^5.0.0" from the root project
npm ERR!
npm ERR! Fix the …Run Code Online (Sandbox Code Playgroud) 我试图npm install在一个相当过时的项目上运行并不断遇到 NPM 依赖错误。我之前在各种项目中遇到过数百个这样的错误,但我还没有找到关于如何阅读它们的良好指南。该线程最接近,但并没有真正描述一般情况,这些文档帮助我理解依赖项的底层结构,但并不能真正帮助我调试。
下面是我现在遇到的错误,从底部开始,我的解释是@aws-amplify/ui-react@1.2.26require react-dom@">=16.7.0",但除此之外我不遵循。它看起来像react-dom@18.2.0require react@"^18.2.0",但我不明白这是如何相关的,因为它react-dom甚至不是我的项目中的依赖项(至少没有明确声明)。
我认为缩进块意味着错误来自嵌套依赖项,但我真的不知道该怎么做。同样,上面的错误也与 相关@aws-amplify/ui-react@1.2.26,但我无法判断它是否导致下面的错误,反之亦然(或者也许它们完全无关?)。
我希望获得 1) 有关如何将 NPM 依赖项错误解读为可操作步骤的一般建议,以及 2) 有关如何修复此特定错误的建议。
另请注意,我已经尝试过npm update @aws-amplify/ui-react@1.2.26,但遇到了类似的错误。
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: myapp@0.0.1
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR! react@"17.0.1" from the root project
npm ERR! peer react@">= 16.7.0" from @aws-amplify/ui-react@1.2.26
npm ERR! node_modules/@aws-amplify/ui-react …Run Code Online (Sandbox Code Playgroud) 运行npm install时出现此错误.这似乎是因为我无法满足某些对等依赖,但我不确定我需要修复哪个对等依赖.
? npm install
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.6.0
npm ERR! npm v2.15.9
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package react@15.3.2 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer belle@2.0.7 wants react@>=0.14.0 || ^15.0.0-rc
npm ERR! peerinvalid Peer material-ui@0.15.4 wants react@^15.0.0
npm ERR! peerinvalid Peer react-infinite@0.9.2 wants react@^15.0.0
npm ERR! peerinvalid Peer react-input-field@1.2.4 wants react@>=0.12.0
npm ERR! peerinvalid Peer react-router@0.13.6 wants react@0.13.x || …Run Code Online (Sandbox Code Playgroud) 我想知道 node_modules 文件夹到底是什么以及用于什么。我知道当我们使用 npm 下载任何库时,该库会转到 node_modules,但我知道当我们要将其上传到 github 时,我们必须忽略 node_modules 文件夹,因为它占用大量空间。通过 package.json 我们可以使用 npm i 下载所有依赖项,我的问题是...假设我想将我的应用程序/网站部署到某个服务器/主机,我是否也必须将 node_modules 文件夹上传到服务器?另一件事,通常我从网站下载我的 jquery 和 bootstrap 并复制到我的项目内的 css/js 文件夹中,但是这次我尝试使用 npm 并且一切都转到 node_modules 并且我使用的是cordova,当我执行命令cordova时build 既不生成我的 jquery 也不生成我的引导程序。所以这就是我的问题,如果我想主持我的项目,我真的必须上传 node_modules 吗?当它是cordova或ionic时,我还必须将node_modules复制到www文件夹吗?如果是,那么使用 npm 下载库有什么意义?这是真的吗?哪一个更好?去网站下载文件并粘贴到 www 或通过 npm 下载?
我在 Heroku 上遇到了问题,因为它不想为我的 Shopify 应用程序安装旧版软件包,我的 Shopify 应用程序位于 Github 上,我只是设置了我的应用程序所需的所有内容,但是当我在 Heroku 上部署主分支时,我得到了下面 Heroku 控制台中出现此错误,有人可以帮我解决这个问题吗?
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
USE_NPM_INSTALL=true
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 16.x...
Downloading and installing node 16.14.0...
Using default npm version: 8.3.1
-----> Restoring cache
Caching has been disabled because NODE_MODULES_CACHE=false
-----> Installing dependencies
Installing node modules (package.json + package-lock)
npm …Run Code Online (Sandbox Code Playgroud) 我想安装 vue-router 但出现一些错误
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: routing01@1.0.0
npm ERR! Found: vue@2.6.14
npm ERR! node_modules/vue
npm ERR! vue@"^2.5.11" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^3.2.0" from vue-router@4.0.15
npm ERR! node_modules/vue-router
npm ERR! vue-router@"4" 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 …Run Code Online (Sandbox Code Playgroud) 在 Angular-14 项目中,我有这个package.json:
包.json:
"dependencies": {
"@angular/animations": "^14.0.0",
"@angular/common": "^14.0.0",
"@angular/compiler": "^14.0.0",
"@angular/core": "^14.0.0",
"@angular/forms": "^14.0.0",
"@angular/platform-browser": "^14.0.0",
"@angular/platform-browser-dynamic": "^14.0.0",
"@angular/router": "^14.0.0",
"@rxweb/reactive-form-validators": "^2.1.7",
"admin-lte": "3.2",
"google-libphonenumber": "^3.2.28",
"intl-tel-input": "^17.0.3",
"ngx-toastr": "^14.3.0",
"npm-check": "^5.9.2",
"rxjs": "~7.5.0",
"sweetalert2": "^11.4.17",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
Run Code Online (Sandbox Code Playgroud)
ngx-bootstrap因此,当我决定使用ngx bootstrap安装时:
npm 安装 ngx-bootstrap --save
我收到这个错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ddm-ui@0.0.0
npm ERR! Found: @angular/animations@14.0.1
npm ERR! …Run Code Online (Sandbox Code Playgroud) 试图减少任何变化的变量并使用我的代码的新拉取。它们不是node-module包或package-lock.json. 我运行npm install我得到这个错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react-native-screens@2.15.2
npm ERR! node_modules/react-native-screens
npm ERR! react-native-screens@"~2.15.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-screens@"^1.0.0 || ^1.0.0-alpha" from react-navigation-drawer@1.4.0
npm ERR! node_modules/react-navigation-drawer
npm ERR! react-navigation-drawer@"^1.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm …Run Code Online (Sandbox Code Playgroud) node.js ×8
npm ×8
npm-install ×4
reactjs ×4
package.json ×3
react-native ×3
angular ×2
node-modules ×2
bootstrap-4 ×1
dependencies ×1
expo ×1
heroku ×1
jquery ×1
next.js ×1
npm-ci ×1
typescript ×1
vue-router ×1
vue.js ×1
vuejs2 ×1
windows ×1