使用ReactJs获取与Babel相关的错误

时间:2015-09-14 13:24:20

标签: javascript npm babeljs

当我尝试运行我的ReactJs项目时,我突然收到以下错误,它之前工作正常,但我不确定是什么原因导致了这一点:

module.js:338
    throw err;
    ^

Error: Cannot find module 'tapable'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/hilarl/Desktop/client/node_modules/webpack/lib/Compiler.js:6:15)
    at Module._compile (module.js:434:26)
    at Module._extensions..js (module.js:452:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/hilarl/Desktop/client/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:214:7)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

npm ERR! Darwin 14.1.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.0.0
npm ERR! npm  v2.14.2
npm ERR! code ELIFECYCLE
npm ERR! @ start: `babel-node --eval "require('./tools/start')().catch(err => console.log(err.stack))"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ start script 'babel-node --eval "require('./tools/start')().catch(err => console.log(err.stack))"'.
npm ERR! This is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     babel-node --eval "require('./tools/start')().catch(err => console.log(err.stack))"
npm ERR! You can get their info via:
npm ERR!     npm owner ls 
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/hilarl/Desktop/client/npm-debug.log


{
  "private": true,
  "engines": {
    "node": ">= 0.10",
    "npm": ">= 2.1"
  },
  "dependencies": {
    "babel": "5.8.21",
    "classnames": "^2.1.3",
    "eventemitter3": "1.1.1",
    "express": "4.13.3",
    "fastclick": "1.0.6",
    "fbjs": "0.1.0-alpha.7",
    "flux": "2.0.3",
    "front-matter": "1.0.0",
    "install": "^0.1.8",
    "jade": "1.11.0",
    "lodash": "3.10.1",
    "normalize.css": "3.0.3",
    "npm": "^2.14.1",
    "react": "^0.14.0-rc1",
    "react-addons-css-transition-group": "^0.14.0-rc1",
    "react-addons-transition-group": "^0.14.0-rc1",
    "react-dom": "^0.14.0-rc1",
    "react-dropzone": "^2.1.0",
    "react-image-placeholder": "^1.0.4",
    "react-loader": "^1.4.0",
    "react-masonry-component": "^1.0.4",
    "react-routing": "0.0.4",
    "react-tag-input": "^1.0.3",
    "reactify": "^1.1.1",
    "router": "^1.1.3",
    "source-map-support": "0.3.2",
    "superagent": "1.3.0"
  },
  "devDependencies": {
    "autoprefixer-core": "^5.2.1",
    "babel-eslint": "^4.0.5",
    "babel-loader": "^5.3.2",
    "browser-sync": "^2.8.2",
    "css-loader": "^0.15.6",
    "csscomb": "^3.1.8",
    "cssnext": "^1.8.3",
    "del": "^1.2.0",
    "eslint": "^1.1.0",
    "eslint-loader": "^1.0.0",
    "eslint-plugin-react": "^3.2.2",
    "gaze": "^0.5.1",
    "git-push": "^0.1.1",
    "glob": "^5.0.14",
    "jest-cli": "^0.4.18",
    "mkdirp": "^0.5.1",
    "ncp": "^2.0.0",
    "postcss": "^4.1.16",
    "postcss-loader": "^0.5.1",
    "postcss-nested": "^0.3.2",
    "psi": "^1.0.6",
    "react-hot-loader": "^1.2.8",
    "replace": "^0.3.0",
    "run-sequence": "^1.1.2",
    "style-loader": "^0.12.3",
    "url-loader": "^0.5.6",
    "webpack": "^1.11.0",
    "webpack-dev-middleware": "^1.2.0",
    "webpack-hot-middleware": "^1.2.0"
  },
  "jest": {
    "rootDir": "./src",
    "scriptPreprocessor": "../preprocessor.js",
    "unmockedModulePathPatterns": [
      "react"
    ]
  },
  "scripts": {
    "lint": "eslint src tools",
    "csslint": "csscomb src/components --lint --verbose",
    "csscomb": "csscomb src/components --verbose",
    "test": "eslint src && jest",
    "clean": "babel-node --eval \"require('./tools/clean')().catch(err => console.log(err.stack))\"",
    "copy": "babel-node --eval \"require('./tools/copy')().catch(err => console.log(err.stack))\"",
    "bundle": "babel-node --eval \"require('./tools/bundle')().catch(err => console.log(err.stack))\"",
    "build": "babel-node --eval \"require('./tools/build')().catch(err => console.log(err.stack))\"",
    "serve": "babel-node --eval \"require('./tools/serve')().catch(err => console.log(err.stack))\"",
    "start": "babel-node --eval \"require('./tools/start')().catch(err => console.log(err.stack))\""
  }
}

1 个答案:

答案 0 :(得分:2)

我们认为您无法提供足够的信息以便找出问题所在。

尝试删除您的包(例如:/ Users / hilarl / Desktop / client / node_modules)

rm -R /Users/hilarl/Desktop/client/node_modules

清理npm缓存:

npm cache clean

然后重试重新安装包

npm i

如果它不起作用,请分享您的新错误消息