[英]npm ERR! notarget No matching version found for type@module
I get this issue whenever I use docker build.每当我使用 docker 构建时,我都会遇到这个问题。 I have a package.json with "type": "module" in "devDependencies" and if remove "type": "module", I can use docker build.
我有一个 package.json,在“devDependencies”中带有“type”:“module”,如果删除“type”:“module”,我可以使用 docker 构建。 But then the app cannot find the index.ejs file, so I kinda need the "type:module" to stay.
但是应用程序找不到 index.ejs 文件,所以我有点需要保留“type:module”。 Any good ideas?
有什么好主意吗?
{
"name": "mediasoup-custom",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node src/app.js",
"mon": "nodemon src/app.js",
"watch": "watchify public/index.js -o public/bundle.js -v",
"type": "module"
},
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"ejs": "^3.1.6",
"express": "^4.17.1",
"httpolyglot": "^0.1.2",
"mediasoup": "^3.7.1",
"mediasoup-client": "^3.6.37",
"mongoose": "^5.12.10",
"protoo-client": "^4.0.4",
"protoo-server": "^4.0.4",
"react": "^17.0.2",
"request": "^2.88.2",
"socket.io": "^2.3.0"
},
"devDependencies": {
"@babel/cli": "^7.14.3",
"@babel/core": "^7.14.3",
"type": "module"
},
"engines": {
"node": "12.19.0"
}
}
> [ 6/10] RUN npm install:
#11 1.042 npm WARN read-shrinkwrap This version of npm is compatible with
lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll
try to do my best with it!
#11 2.810 npm ERR! code ETARGET
#11 2.817 npm ERR! notarget No matching version found for type@module.
#11 2.818 npm ERR! notarget In most cases you or one of your dependencies are
requesting
#11 2.818 npm ERR! notarget a package version that doesn't exist.
#11 2.818 npm ERR! notarget
#11 2.818 npm ERR! notarget It was specified as a dependency of 'app'
#11 2.818 npm ERR! notarget
#11 2.826
#11 2.826 npm ERR! A complete log of this run can be found in:
#11 2.826 npm ERR! /root/.npm/_logs/2021-09-09T22_41_21_395Z-debug.log
------
executor failed running [/bin/sh -c npm install]: exit code: 1
OK so i found a fix.好的,所以我找到了解决办法。
I created a optional dependancy section and added the "type:module".我创建了一个可选的依赖部分并添加了“类型:模块”。
Afterwards I was able to deploy to droplet.之后我能够部署到 Droplet。
"optionalDependencies": {
"type": "module"
},
This is just non-sense: type
isn't the name of a package, and module
isn't a valid version.这简直是胡说八道:
type
不是 package 的名称, module
不是有效版本。 None of this goes in the dependency sections;这些都不在依赖部分;
"type": "module"
should be at the top-level in package.json. "type": "module"
应该在 package.json 中的顶层。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.