npm start 但看到错误

Posted

技术标签:

【中文标题】npm start 但看到错误【英文标题】:npm start but see error 【发布时间】:2016-10-30 04:27:30 【问题描述】:

我启动 npm 但看到错误,我不知道修复。请帮帮我

"D:\phpStorm 2016.1.2\bin\runnerw.exe" D:\nodejs\node.exe D:\nodejs\node_modules\npm\bin\npm-cli.js run-script start

> pickuphub@0.3.0 start E:\phong.pham\Developer\phpDev\pickuphub.net
> npm run start:tunnel


> pickuphub@0.3.0 start:tunnel E:\phong.pham\Developer\phpDev\pickuphub.net
> cross-env NODE_ENV=development node internals/server

CarteBlanche started at /carte-blanche
Server started ✓


Access URLs:
-----------------------------------
Localhost: http://localhost:3000
      LAN: http://192.168.0.107:3000
-----------------------------------
Press CTRL-C to stop

错误:

Uncaught Exception...
TypeError: d.getWarnings is not a function
    at E:\phong.pham\Developer\phpDev\pickuphub.net\node_modules\webpack\lib\Compilation.js:594:21
    at Array.forEach (native)
    at E:\phong.pham\Developer\phpDev\pickuphub.net\node_modules\webpack\lib\Compilation.js:593:22
    at Array.forEach (native)
    at Compilation.reportDependencyWarnings (E:\phong.pham\Developer\phpDev\pickuphub.net\node_modules\webpack\lib\Compilation.js:592:9)
    at Compilation.<anonymous> (E:\phong.pham\Developer\phpDev\pickuphub.net\node_modules\webpack\lib\Compilation.js:483:8)
    at Array.forEach (native)
    at Compilation.seal (E:\phong.pham\Developer\phpDev\pickuphub.net\node_modules\webpack\lib\Compilation.js:482:15)
    at Compiler.<anonymous> (E:\phong.pham\Developer\phpDev\pickuphub.net\node_modules\webpack\lib\Compiler.js:431:15)
    at E:\phong.pham\Developer\phpDev\pickuphub.net\node_modules\webpack\node_modules\tapable\lib\Tapable.js:152:11
Uncaught Exception...
undefined

错误: npm 错误! Windows_NT 10.0.10586 npm 错误! argv "D:\nodejs\node.exe" "C:\Users\phamv\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "start:tunnel" npm 错误!节点 v4.4.5 npm 错误! npm v3.9.6 npm 错误!代码生命周期 npm 错误! pickhub@0.3.0 开始:隧道:cross-env NODE_ENV=development node internals/server npm 错误!退出状态 1 npm 错误! npm 错误!在pickhub@0.3.0 start:tunnel 脚本'cross-env NODE_ENV=development node internals/server'处失败。 npm 错误!确保您安装了最新版本的 node.js 和 npm。 npm 错误!如果你这样做了,这很可能是pickhub 包的问题,​​ npm 错误!不是 npm 本身。 npm 错误!告诉作者这在您的系统上失败: npm 错误! cross-env NODE_ENV=开发节点内部/服务器 npm 错误!您可以通过以下方式获取有关如何为此项目打开问题的信息: npm 错误! npm 错误 npm 错误!或者,如果这不可用,您可以通过以下方式获取他们的信息: npm 错误! npm 所有者 ls Pickhub npm 错误!上面可能还有额外的日志输出。

    npm ERR! Please include the following file with any support request:
    npm ERR!     E:\phong.pham\Developer\phpDev\pickuphub.net\npm-debug.log

    npm ERR! Windows_NT 10.0.10586
    npm ERR! argv "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "start"
    npm ERR! node v4.4.5
    npm ERR! npm  v2.15.5
    npm ERR! code ELIFECYCLE
    npm ERR! pickuphub@0.3.0 start: `npm run start:tunnel`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the pickuphub@0.3.0 start script 'npm run start:tunnel'.
    npm ERR! This is most likely a problem with the pickuphub package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     npm run start:tunnel
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs pickuphub
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR! 
    npm ERR!     npm owner ls pickuphub
    npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request:
    npm ERR!     E:\phong.pham\Developer\phpDev\pickuphub.net\npm-debug.log

    Process finished with exit code 1

i begin learn reactjs and using nodejs . please help me
package.json

  "name": "pickuphub",
  "version": "0.3.0",
  "private": true,
  "dllPlugin": 
    "path": "node_modules/pickuphub-dlls",
    "exclude": [
      "sanitize.css"
    ],
    "include": [
      "babel-polyfill",
      "core-js",
      "eventsource-polyfill",
      "lodash"
    ]
  ,
  "dependencies": 
    "angle-input": "git+https://github.com/hosmelq/angle-input.git",
    "babel-polyfill": "^6.9.1",
    "classnames": "^2.2.5",
    "date-fns": "^1.3.0",
    "draft-js": "^0.7.0",
    "elemental": "^0.5.14",
    "history": "^3.0.0",
    "humps": "^1.1.0",
    "immutable": "^3.8.1",
    "is-absolute-url": "^2.0.0",
    "lodash-es": "^4.13.1",
    "moment": "^2.13.0",
    "normalizr": "^2.1.0",
    "query-string": "^4.2.2",
    "raven-js": "^3.1.0",
    "rc-switch": "^1.4.2",
    "rc-tooltip": "^3.3.5",
    "react": "^15.1.0",
    "react-addons-css-transition-group": "^15.1.0",
    "react-addons-shallow-compare": "^15.1.0",
    "react-dom": "^15.1.0",
    "react-dropzone": "^3.5.1",
    "react-highlighter": "^0.3.2",
    "react-immutable-proptypes": "^1.7.1",
    "react-masonry-component": "^4.0.4",
    "react-modal": "^1.3.0",
    "react-nl2br": "^0.1.1",
    "react-redux": "^4.4.5",
    "react-relay": "^0.9.0",
    "react-router": "^2.5.0",
    "react-router-redux": "^4.0.5",
    "react-router-relay": "^0.13.3",
    "react-router-scroll": "^0.2.0",
    "react-select": "^1.0.0-beta9",
    "react-slick": "^0.12.2",
    "react-url": "^1.0.0",
    "reactable": "^0.13.2",
    "recompose": "^0.20.0",
    "recompose-relay": "^0.3.0",
    "redux": "^3.5.2",
    "redux-api-middleware": "^1.0.2",
    "redux-form": "^5.2.5",
    "redux-immutable": "^3.0.6",
    "redux-saga": "^0.10.5",
    "reselect": "^2.5.1",
    "sanitize.css": "^4.0.0",
    "speakingurl": "^9.0.0",
    "superagent": "^2.0.0",
    "validator": "^5.4.0",
    "whatwg-fetch": "^1.0.0"
  ,
  "devDependencies": 
    "babel-core": "^6.10.4",
    "babel-loader": "^6.2.4",
    "babel-plugin-react-relay": "^0.9.0",
    "babel-plugin-transform-react-constant-elements": "^6.9.1",
    "babel-plugin-transform-react-inline-elements": "^6.8.0",
    "babel-plugin-transform-react-pure-class-to-function": "^1.0.1",
    "babel-plugin-transform-react-remove-prop-types": "^0.2.7",
    "babel-plugin-transform-runtime": "^6.9.0",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-es2015-webpack": "^6.4.1",
    "babel-preset-react": "^6.5.0",
    "babel-preset-react-hmre": "^1.1.1",
    "babel-preset-stage-0": "^6.5.0",
    "babel-runtime": "^6.9.2",
    "bootstrap": "github:twbs/bootstrap#v4-dev",
    "bootstrap-datepicker": "^1.6.1",
    "carte-blanche": "^0.2.3",
    "carte-blanche-react-plugin": "^0.2.2",
    "carte-blanche-source-plugin": "^0.1.0",
    "chalk": "^1.1.3",
    "chart.js": "^1.1.1",
    "compression": "^1.6.2",
    "cross-env": "^1.0.8",
    "css-loader": "^0.23.1",
    "enzyme": "^2.3.0",
    "eonasdan-bootstrap-datetimepicker": "^4.15.35",
    "eventsource-polyfill": "^0.9.6",
    "expect": "^1.20.1",
    "expect-jsx": "^2.6.0",
    "exports-loader": "^0.6.3",
    "expose-loader": "^0.7.1",
    "express": "^4.14.0",
    "extract-text-webpack-plugin": "^1.0.1",
    "fastclick": "^1.0.6",
    "file-loader": "^0.9.0",
    "font-awesome": "^4.6.3",
    "gmaps": "^0.4.24",
    "gulp": "^3.9.1",
    "handlebars": "^4.0.5",
    "highcharts": "^4.2.5",
    "hint.css": "^2.3.1",
    "image-webpack-loader": "^1.8.0",
    "imports-loader": "^0.6.5",
    "ip": "^1.1.3",
    "jquery": "^2.2.4",
    "jquery-ui-touch-punch": "^0.2.3",
    "jquery.maskedinput": "^1.4.1",
    "json-loader": "^0.5.4",
    "laravel-elixir": "^6.0.0-4",
    "laravel-elixir-uncss": "^2.1.0",
    "material-design-icons": "^2.2.3",
    "minimist": "^1.2.0",
    "ngrok": "^2.2.1",
    "normalize.css": "^4.1.1",
    "offline-plugin": "^3.4.0",
    "plop": "^1.5.0",
    "postcss-cssnext": "^2.6.0",
    "postcss-focus": "^1.0.0",
    "postcss-import": "8.1.0",
    "postcss-loader": "^0.9.1",
    "postcss-reporter": "^1.3.3",
    "progressbar.js": "^1.0.1",
    "raw-loader": "^0.5.1",
    "rc-slider": "^3.7.2",
    "react-bootstrap-table": "^2.3.6",
    "react-motion": "^0.4.4",
    "rimraf": "^2.5.2",
    "select2": "^4.0.3",
    "select2-bootstrap-theme": "0.1.0-beta.7",
    "shelljs": "^0.7.0",
    "style-loader": "^0.13.1",
    "sw-precache": "^3.2.0",
    "sweetalert": "^1.1.3",
    "twitter-bootstrap-wizard": "^1.2.0",
    "url-loader": "^0.5.7",
    "webpack": "^2.1.0-beta.13",
    "webpack-dev-middleware": "^1.6.1",
    "webpack-hot-middleware": "^2.10.0",
    "webpack-manifest-plugin": "^1.0.1",
    "why-did-you-update": "0.0.8"
  ,
  "engines": 
    "npm": ">=3"
  ,
  "react-relay-schema": "http://api.pickuphub.net/schema.json",
  "scripts": 
    "analyze": "node ./internals/scripts/analyze.js",
    "build": "npm run build:clean && npm run build:webpack && npm run build:gulp",
    "build:clean": "rimraf ./web/build-webpack/*",
    "build:dll": "node ./internals/scripts/dependencies.js",
    "build:gulp": "gulp --production",
    "build:webpack": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --bail --color",
    "generate": "plop --plopfile internals/generators/index.js",
    "npmcheckversion": "node ./internals/scripts/npmcheckversion.js",
    "postinstall": "npm run build:dll",
    "postsetup": "npm run build:dll",
    "preinstall": "npm run npmcheckversion",
    "start": "npm run start:tunnel",
    "start:tunnel": "cross-env NODE_ENV=production node internals/server"
  

【问题讨论】:

你在运行 npm run start:tunnel 之前运行过 npm install 吗?除此之外,您的 npm 版本看起来很旧,可能值得更新以查看是否可以修复它 我之前运行 npm install ,之后我运行 start:tunnel show error 【参考方案1】:

在将“carte-blanche”添加到之前运行良好的项目后,我遇到了完全相同的问题。由于控制台中的错误状态...开始调查,只需转到“node_modules/webpack/lib/Compilation.js”文件并滚动到“594”行(就像错误告诉你的那样)。然后在第 594 行,我稍微修改了文件:

if (!d.getWarnings) 
  console.info('doh!', d.module.dependenciesErrors);

好吧,我现在已经走得更远了,因为我只输出“module.dependenciesErrors”,但您可以从简单地输出“d”开始。

正如错误告诉你的那样,“d.getWarnings”不是一个函数!如果我们可以检测到错误案例并使用“console.info”我们可以开始调查。

现在我仍然完全不知道为什么“d”突然没有“getWarnings”功能了,而所有其他 d 显然都有它(或者 webpack 编译永远不会工作:P)

但是现在我开始看到真正的原因是什么,我猜最后导致错误 -> carte-blanche 没有找到一些文件夹 -.- 非常烦人,这不能只报告给控制台.. .

我认为这种“d.getWarnings 不是函数”可能会发生所有可能的依赖问题/错误 - 它不会直接与 carte-blanche 或此处提到的 :tunnel 脚本或其他任何内容相关。我认为 everything 在 webpack 项目中构建依赖项期间出现的问题可能会导致这种情况。

【讨论】:

以上是关于npm start 但看到错误的主要内容,如果未能解决你的问题,请参考以下文章

npm start 在nodejs中给出错误

运行 npm start 一直显示错误

无法运行镜像,CMD ["npm", "start"] 命令错误

我试图运行命令“npm run start”,它在 react js 中显示了这个错误

如何修复缺少的脚本错误和 npm start?

无法运行“npm start”显示错误。如何解决?