0

I get this weird error when I want to run my vue-cli project:

ERROR  Error: Cannot find module 'websocket-driver'
Error: Cannot find module 'websocket-driver'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/me/Cloud/workspace/atom/WebApps/myproject/node_modules/faye-websocket/lib/faye/websocket.js:8:14)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! myproject@1.0.0 start: `vue-cli-service serve --copy`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myproject@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/me/.npm/_logs/2018-10-17T07_38_22_837Z-debug.log

I’ve tried the following ways to install websocket-driver module, but not a single one of these tries have worked for me: npm i websocket-driver, npm i -gwebsocket-driver and npm i websocket-driver -D

npm list faye-websocket shows that this package is part of @vue/cli-service, so I'm surprised to see no one else reporting this issue.

Below is my npm package file:

package.json

{
  "name": "myproject",
  "description": "",
  "version": "1.0.0",
  "private": false,
  "main": "main.js",
  "license": "GPL-3.0",
  "repository": {
    "type": "git",
    "url": ""
  },
  "scripts": {
    "serve": "vue-cli-service serve",
    "start": "vue-cli-service serve --copy",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "vue": "~2.5.0",
    "vue-router": "~3.0.0",
    "websocket-driver": "0.7.0"
  },
  "devDependencies": {
    "@babel/core": "~7.0.0",
    "@babel/helper-module-imports": "~7.0.0",
    "@maidsafe/safe-node-app": "~0.9.1",
    "@vue/cli-plugin-babel": "3.0.0-alpha.3",
    "@vue/cli-plugin-eslint": "~3.0.0",
    "@vue/cli-service": "~3.0.0",
    "@vue/eslint-config-standard": "3.0.0-beta.9",
    "ajv": "~6.0.0",
    "babel-plugin-root-import": "~6.1.0",
    "eslint": "~4.19.0",
    "eslint-plugin-node": "~6.0.0",
    "eslint-plugin-promise": "~4.0.0",
    "eslint-plugin-standard": "~3.0.0",
    "vue-template-compiler": "~2.5.0"
  }
}
4

1 回答 1

0

通过删除node_modules和重新安装包解决。

于 2018-10-17T15:38:04.863 回答