Npm 无法启动服务器,完整日志在这里。该项目可以在其他PC上运行

Posted

技术标签:

【中文标题】Npm 无法启动服务器,完整日志在这里。该项目可以在其他PC上运行【英文标题】:Npm can't start server, full log is here. This project can run on other PC 【发布时间】:2021-11-22 20:53:14 【问题描述】:

我有一个从其他电脑复制的vue N​​odeJs项目,它可以在其他电脑上运行,我在这台电脑上安装了node js,只是不能像其他电脑一样运行这个项目。我需要找出问题出在哪里。 npm 版本为 7.21.1,Node js 版本为 16.9.1。 我执行 npm run serve 并显示错误:

npm ERR! invalid options argument
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2021-10-01T07_07_50_208Z-debug.log
98% after emitting CopyPlugin

完整的错误日志和 package.json 在下面 完整的错误日志:

0 verbose cli [
    0 verbose cli   'D:\\NodeJS\\node.exe',
    0 verbose cli   'D:\\NodeJS\\node_modules\\npm\\bin\\npm-cli.js',
    0 verbose cli   'run',
    0 verbose cli   'serve'
    0 verbose cli ]
    1 info using npm@7.21.1
    2 info using node@v16.9.1
    3 timing npm:load:whichnode Completed in 0ms
    4 timing config:load:defaults Completed in 1ms
    5 timing config:load:file:D:\NodeJS\node_modules\npm\npmrc Completed in 2ms
    6 timing config:load:builtin Completed in 2ms
    7 timing config:load:cli Completed in 3ms
    8 timing config:load:env Completed in 1ms
    9 timing config:load:file:D:\JetBrainsProject\hospital_full\vue\.npmrc Completed in 0ms
    10 timing config:load:project Completed in 1ms
    11 timing config:load:file:C:\Users\Administrator\.npmrc Completed in 0ms
    12 timing config:load:user Completed in 1ms
    13 timing config:load:file:C:\Users\Administrator\AppData\Roaming\npm\etc\npmrc Completed in 0ms
    14 timing config:load:global Completed in 0ms
    15 timing config:load:validate Completed in 0ms
    16 timing config:load:credentials Completed in 1ms
    17 timing config:load:setEnvs Completed in 1ms
    18 timing config:load Completed in 11ms
    19 timing npm:load:configload Completed in 12ms
    20 timing npm:load:setTitle Completed in 0ms
    21 timing npm:load:setupLog Completed in 1ms
    22 timing config:load:flatten Completed in 3ms
    23 timing npm:load:cleanupLog Completed in 2ms
    24 timing npm:load:configScope Completed in 0ms
    25 timing npm:load:projectScope Completed in 1ms
    26 timing npm:load Completed in 20ms
    27 verbose stack TypeError: invalid options argument
    27 verbose stack     at optsArg (D:\NodeJS\node_modules\npm\node_modules\mkdirp\lib\opts-arg.js:13:11)
    27 verbose stack     at mkdirp (D:\NodeJS\node_modules\npm\node_modules\mkdirp\index.js:11:10)
    27 verbose stack     at tryCatcher (D:\NodeJS\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
    27 verbose stack     at ret (eval at makeNodePromisifiedEval (D:\NodeJS\node_modules\npm\node_modules\bluebird\js\release\promisify.js:184:12), <anonymous>:13:39)
    27 verbose stack     at Object.mkdirfix (D:\NodeJS\node_modules\npm\node_modules\npm-registry-fetch\node_modules\cacache\lib\util\fix-owner.js:36:10)
    27 verbose stack     at makeTmp (D:\NodeJS\node_modules\npm\node_modules\npm-registry-fetch\node_modules\cacache\lib\content\write.js:121:19)
    27 verbose stack     at write (D:\NodeJS\node_modules\npm\node_modules\npm-registry-fetch\node_modules\cacache\lib\content\write.js:35:19)
    27 verbose stack     at putData (D:\NodeJS\node_modules\npm\node_modules\npm-registry-fetch\node_modules\cacache\put.js:11:10)
    27 verbose stack     at Object.x.put (D:\NodeJS\node_modules\npm\node_modules\npm-registry-fetch\node_modules\cacache\locales\en.js:28:37)
    27 verbose stack     at WriteStream._flush (D:\NodeJS\node_modules\npm\node_modules\npm-registry-fetch\node_modules\make-fetch-happen\cache.js:156:21)
    27 verbose stack     at WriteStream._write (D:\NodeJS\node_modules\npm\node_modules\flush-write-stream\index.js:36:35)
    27 verbose stack     at doWrite (D:\NodeJS\node_modules\npm\node_modules\readable-stream\lib\_stream_writable.js:428:64)
    27 verbose stack     at writeOrBuffer (D:\NodeJS\node_modules\npm\node_modules\readable-stream\lib\_stream_writable.js:417:5)
    27 verbose stack     at WriteStream.Writable.write (D:\NodeJS\node_modules\npm\node_modules\readable-stream\lib\_stream_writable.js:334:11)
    27 verbose stack     at WriteStream.end (D:\NodeJS\node_modules\npm\node_modules\flush-write-stream\index.js:45:41)
    27 verbose stack     at WriteStream.end (D:\NodeJS\node_modules\npm\node_modules\flush-write-stream\index.js:42:47)
    28 verbose cwd D:\JetBrainsProject\hospital_full\vue
    29 verbose Windows_NT 10.0.19042
    30 verbose argv "D:\\NodeJS\\node.exe" "D:\\NodeJS\\node_modules\\npm\\bin\\npm-cli.js" "run" "serve"
    31 verbose node v16.9.1
    32 verbose npm  v7.21.1
    33 error invalid options argument
    34 verbose exit 1

package.json:


  "name": "vue-hk",
  "version": "0.1.0",
  "private": true,
  "scripts": 
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build"
  ,
  "dependencies": 
    "axios": "^0.20.0",
    "core-js": "^3.6.5",
    "element-ui": "^2.4.5",
    "vue": "^2.6.11",
    "vue-axios": "^3.3.7",
    "vue-router": "^3.2.0",
    "vuex": "^3.4.0"
  ,
  "devDependencies": 
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-vuex": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "babel-plugin-component": "^1.1.1",
    "less": "^3.12.2",
    "less-loader": "^7.0.1",
    "vue-cli-plugin-element": "^1.0.1",
    "vue-template-compiler": "^2.6.11"
  

【问题讨论】:

【参考方案1】:

已修复,我什至无法在这台电脑上创建一个新的 node npm 项目,当我使用idea 创建一个新的 node npm 项目时出现相同类型的错误,node js 本身可能是问题,我重新安装了 node 并且一切正常

【讨论】:

以上是关于Npm 无法启动服务器,完整日志在这里。该项目可以在其他PC上运行的主要内容,如果未能解决你的问题,请参考以下文章

systemd相关

无法 npm 使用 eslint 依赖项启动我的 React 项目

可以在 npm run dev - ubuntu 中找到此运行的完整日志

排查tomcat服务器启动,项目无法运行故障

错误:这可能不是 npm 的问题。上面可能有额外的日志输出

一天一坑系列SpringCloud微服务项目本地可以正常启动,但在Flink中却无法启动,莫名其妙????