我的项目直到今天才开始建设。为了清楚起见,我没有改变任何东西。奇怪的是,它也发生在我几周没有碰过的另一个 NPM 项目上。
我收到以下错误(见下文)。我尝试删除我的node_modules并随后运行“npm install”。某些库似乎直接引用“nanoid/non-secure”,但 NPM 并未安装它。当我将“nanoid”安装为 devDependency 时,我收到了一大堆其他错误。
================PACKAGE.JSON================================== ====
{
"name": "sysifix.vue-ui",
"version": "0.0.0",
"description": "Sysifix.VueUI",
"private": true,
"author": {
"name": "Rivera, Rashad"
},
"scripts": {
"serve": "vue-cli-service serve --copy",
"build": "vue-cli-service build --mode production",
"build_dev": "vue-cli-service build --mode development",
"lint": "vue-cli-service lint --no-fix",
"lint_fix": "vue-cli-service lint",
"clean": "",
"test": "jest",
"test_watch": "jest --watchAll"
},
"dependencies": {
"axios": "~0.21.1",
"core-js": "~3.6.5",
"moment": "~2.29.0",
"name-of": "~1.0.2",
"vue": "~2.6.12",
"vue-class-component": "~7.2.6",
"vue-property-decorator": "~9.0.0",
"vue-router": "~3.4.5",
"vue-the-mask": "~0.11.1",
"vue-unique-id": "~3.1.1",
"vuedraggable": "~2.24.3",
"vuetify": "~2.3.12",
"vuetify-confirm": "~2.0.6",
"vuex": "~3.5.1",
"vuex-class": "~0.3.2",
"vuex-router-sync": "~5.0.0"
},
"devDependencies": {
"@fortawesome/fontawesome-free": "~5.15.0",
"@types/jest": "~26.0.14",
"@types/vue-the-mask": "~0.11.1",
"@typescript-eslint/eslint-plugin": "~4.3.0",
"@typescript-eslint/parser": "~4.3.0",
"@vue/cli-plugin-babel": "~4.5.6",
"@vue/cli-plugin-eslint": "~4.5.6",
"@vue/cli-plugin-router": "~4.5.6",
"@vue/cli-plugin-typescript": "~4.5.6",
"@vue/cli-service": "~4.5.6",
"@vue/eslint-config-airbnb": "~5.1.0",
"@vue/eslint-config-typescript": "~5.1.0",
"@vue/test-utils": "~1.1.0",
"babel-core": "~7.0.0-bridge.0",
"babel-jest": "~26.6.3",
"eslint": "~7.10.0",
"eslint-plugin-vue": "~7.0.0",
"jest": "~26.5.3",
"jest-transform-stub": "~2.0.0",
"sass": "~1.26.11",
"sass-loader": "~10.0.2",
"ts-jest": "~26.4.1",
"ts-nameof": "~5.0.0",
"typescript": "~4.0.3",
"vue-cli-plugin-vuetify": "~2.0.7",
"vue-jest": "~3.0.7",
"vue-template-compiler": "~2.6.12",
"vuetify-loader": "~1.7.1"
},
"resolutions": {},
"postcss": {
"plugins": {
"autoprefixer": {}
}
}
}
================VUE.CONFIG.JSON============================== ===
/* eslint-disable */
module.exports = {
publicPath: process.env.BASE_URL,
transpileDependencies: ['vuetify'],
devServer: {
compress: true,
proxy: {
'^/ui/api': {
pathRewrite: { '^/ui/api': '/api' },
target: process.env.VUE_APP_DEV_API_URL,
ws: true,
changeOrigin: true,
},
},
},
chainWebpack: (config) => {
config.module.rule('vue').uses.delete('cache-loader');
config.module.rule('js').uses.delete('cache-loader');
config.module.rule('tsx').uses.delete('cache-loader');
config.module.rule('ts').uses.delete('cache-loader');
},
parallel: true,
};
================错误==================================== ==
C:\Temp>npm install
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: This loader has been deprecated. Please use eslint-webpack-plugin
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: 3.x is no longer supported
npm WARN deprecated @hapi/[email protected]: Moved to 'npm install @sideway/address'
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/[email protected]: Switch to 'npm install joi'
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
added 1928 packages, and audited 1929 packages in 20s
100 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
C:\Temp>npm run serve
> [email protected] serve
> vue-cli-service serve --copy
INFO Starting development server...
ERROR Error: Cannot find module 'nanoid/non-secure'
Require stack:
- C:\Temp\node_modules\postcss\lib\input.js
- C:\Temp\node_modules\postcss\lib\parse.js
- C:\Temp\node_modules\postcss\lib\lazy-result.js
- C:\Temp\node_modules\postcss\lib\postcss.js
- C:\Temp\node_modules\@vue\component-compiler-utils\dist\compileStyle.js
- C:\Temp\node_modules\@vue\component-compiler-utils\dist\index.js
- C:\Temp\node_modules\vue-loader\lib\index.js
- C:\Temp\node_modules\@vue\cli-service\lib\config\base.js
- C:\Temp\node_modules\@vue\cli-service\lib\Service.js
- C:\Temp\node_modules\@vue\cli-service\bin\vue-cli-service.js
Error: Cannot find module 'nanoid/non-secure'
Require stack:
- C:\Temp\node_modules\postcss\lib\input.js
- C:\Temp\node_modules\postcss\lib\parse.js
- C:\Temp\node_modules\postcss\lib\lazy-result.js
- C:\Temp\node_modules\postcss\lib\postcss.js
- C:\Temp\node_modules\@vue\component-compiler-utils\dist\compileStyle.js
- C:\Temp\node_modules\@vue\component-compiler-utils\dist\index.js
- C:\Temp\node_modules\vue-loader\lib\index.js
- C:\Temp\node_modules\@vue\cli-service\lib\config\base.js
- C:\Temp\node_modules\@vue\cli-service\lib\Service.js
- C:\Temp\node_modules\@vue\cli-service\bin\vue-cli-service.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Temp\node_modules\postcss\lib\input.js:6:18)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\Temp\node_modules\postcss\lib\parse.js:5:13)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
C:\Temp>npm ls --depth=1
[email protected] C:\Temp
+-- @fortawesome/[email protected]
+-- @types/[email protected]
| +-- [email protected]
| `-- [email protected]
+-- @types/[email protected]
| `-- [email protected] deduped
+-- @typescript-eslint/[email protected]
| +-- @typescript-eslint/[email protected]
| +-- @typescript-eslint/[email protected] deduped
| +-- @typescript-eslint/[email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected]
+-- @typescript-eslint/[email protected]
| +-- @typescript-eslint/[email protected] deduped
| +-- @typescript-eslint/[email protected]
| +-- @typescript-eslint/[email protected]
| +-- [email protected] deduped
| `-- [email protected] deduped
+-- @vue/[email protected]
| +-- @babel/[email protected]
| +-- @vue/[email protected]
| +-- @vue/[email protected] deduped
| +-- @vue/[email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected]
+-- @vue/[email protected]
| +-- @vue/[email protected] deduped
| +-- @vue/[email protected] deduped
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| `-- [email protected]
+-- @vue/[email protected]
| +-- @vue/[email protected] deduped
| `-- @vue/[email protected] deduped
+-- @vue/[email protected]
| +-- @types/[email protected]
| +-- @vue/[email protected] deduped
| +-- @vue/[email protected] deduped
| +-- UNMET OPTIONAL DEPENDENCY @vue/compiler-sfc@^3.0.0-beta.14
| +-- [email protected] deduped
| +-- fork-ts-checker-webpack-plugin-v5@npm:[email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected] deduped
| `-- [email protected] deduped
+-- @vue/[email protected]
| +-- @intervolga/[email protected]
| +-- @soda/[email protected]
| +-- @soda/[email protected]
| +-- @types/[email protected]
| +-- @types/[email protected]
| +-- @types/[email protected]
| +-- @vue/[email protected]
| +-- @vue/[email protected] deduped
| +-- @vue/[email protected]
| +-- @vue/[email protected] deduped
| +-- UNMET OPTIONAL DEPENDENCY @vue/compiler-sfc@^3.0.0-beta.14
| +-- @vue/[email protected]
| +-- @vue/[email protected]
| +-- @vue/[email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- ssri@~6.0.2 invalid
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- vue-loader-v16@npm:[email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected] deduped
+-- @vue/[email protected]
| +-- @vue/[email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected] deduped
+-- @vue/[email protected]
| +-- @typescript-eslint/[email protected] deduped invalid
| +-- @typescript-eslint/[email protected] deduped invalid
| +-- [email protected] deduped
| +-- [email protected] deduped
| `-- [email protected]
+-- @vue/[email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| `-- [email protected] deduped
+-- [email protected]
| `-- [email protected]
+-- [email protected]
| `-- @babel/[email protected] deduped
+-- [email protected]
| +-- @babel/[email protected] deduped
| +-- @jest/[email protected]
| +-- @jest/[email protected]
| +-- @types/[email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected]
+-- [email protected]
+-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| `-- [email protected] deduped
+-- [email protected]
| +-- @babel/[email protected]
| +-- @eslint/[email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected]
+-- [email protected]
+-- [email protected]
| +-- @jest/[email protected]
| +-- [email protected]
| `-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
| +-- UNMET OPTIONAL DEPENDENCY fibers@>= 3.1.0
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- UNMET OPTIONAL DEPENDENCY node-sass@^4.0.0
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| `-- [email protected] deduped
+-- [email protected]
| `-- [email protected]
+-- [email protected]
| +-- @types/[email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| `-- [email protected]
+-- [email protected]
| +-- @ts-nameof/[email protected]
| +-- @ts-nameof/[email protected]
| +-- [email protected]
| `-- [email protected] deduped
+-- [email protected]
+-- [email protected]
| `-- [email protected] deduped
+-- [email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected]
+-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| `-- [email protected] deduped
+-- [email protected]
| +-- [email protected] deduped
| `-- [email protected] deduped
+-- [email protected]
+-- [email protected]
| +-- [email protected]
| `-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
| `-- [email protected]
+-- [email protected]
| +-- [email protected] deduped
| `-- [email protected] deduped
+-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected] deduped
| `-- [email protected] deduped
+-- [email protected]
| `-- [email protected] deduped
+-- [email protected]
| +-- [email protected] deduped
| +-- [email protected] deduped
| `-- [email protected] deduped
+-- [email protected]
| +-- [email protected] deduped
| `-- [email protected] deduped
`-- [email protected]
`-- [email protected] deduped
我刚刚遇到了同样的问题。 尝试检查您是否将节点模块安装在正确的目录中,即您为服务器编写代码的位置。
我知道这个消息可能有点晚了,但我相信这对于将来遇到同样问题的其他人来说可能是有益的。我在创建新的 Angular 项目时遇到了类似的错误,但就我而言,这并不是由于版本不兼容。但是,我能够通过删除该项目并重新创建它来解决它。该问题可能是由于初始项目创建过程中的互联网连接中断或问题引起的。我建议尝试删除并重新创建项目的相同解决方案,看看是否可以解决问题。