没有找到Npm预发布脚本webpack

时间:2017-04-12 10:53:32

标签: node.js npm webpack

我正在尝试修改npm模块,我想将修改后的模块包含为本地依赖项。

在托管上部署此应用程序时,我面临一个奇怪的webpack未找到问题。我设法通过全局删除webpack来重现本地计算机中的问题。

我的package.json:

1)我尝试在package.json依赖项中包含本地模块:

{
  "name": "parse-server-example",
  "version": "1.4.0",
  "description": "An example Parse API server using the parse-server module",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/ParsePlatform/parse-server-example"
  },
  "license": "MIT",
  "dependencies": {
    "webpack": "2.3.3",
    "express": "~4.11.x",
    "kerberos": "~0.0.x",
    "parse": "~1.8.0",
    "parse-dashboard-simple": "./parse-dashboard-simple",
    "parse-server": "*"
  },
  "scripts": {
    "start": "node index.js"
  },
  "engines": {
    "node": "7.6.0"
  }
}

请注意我有一个名为“./parse-dashboard-simple”的本地模块。

我的本地模块的package.json:

{
  "name": "parse-dashboard",
  "parseDashboardFeatures": [
    "Data Browser",
    "Cloud Code Viewer",
    "Cloud Code Jobs Viewer and Runner",
    "Parse Config",
    "API Console",
    "Class Level Permissions Editor",
    "Pointer Permissions Editor",
    "Send Push Notifications",
    "Logs Viewer",
    "Push Status Page",
    "Relation Editor"
  ],
  "description": "The Parse Dashboard",
  "keywords": [
    "parse",
    "dashboard"
  ],
  "homepage": "https://github.com/ParsePlatform/parse-dashboard",
  "bugs": "https://github.com/ParsePlatform/parse-dashboard/issues",
  "version": "1.0.25",
  "repository": {
    "type": "git",
    "url": "https://github.com/ParsePlatform/parse-dashboard"
  },
  "license": "SEE LICENSE IN LICENSE",
  "files": [
    "Parse-Dashboard",
    "bin",
    "README.md",
    "LICENSE"
  ],
  "dependencies": {
    "bcryptjs": "^2.3.0",
    "body-parser": "^1.15.2",
    "commander": "^2.9.0",
    "connect-flash": "^0.1.1",
    "cookie-session": "^2.0.0-alpha.1",
    "csurf": "^1.9.0",
    "express": "^4.13.4",
    "json-file-plus": "^3.2.0",
    "package-json": "^2.3.1",
    "passport": "^0.3.2",
    "passport-local": "^1.0.0",
    "webpack": "~1.12.0"
  },
  "devDependencies": {
    "babel-core": "~5.8.12",
    "babel-loader": "~5.3.0",
    "babel-plugin-remove-proptypes": "~1.0.0",
    "babel-polyfill": "^6.7.2",
    "babel-runtime": "~5.8.25",
    "css-loader": "~0.18.0",
    "file-loader": "^0.8.5",
    "history": "^2.1.2",
    "http-server": "~0.8.5",
    "immutable": "~3.7.5",
    "immutable-devtools": "~0.0.4",
    "jest-cli": "^12.0.2",
    "js-beautify": "~1.5.0",
    "marked": "^0.3.5",
    "node-sass": "^3.7.0",
    "parse": "1.6.14",
    "prismjs": "~1.2.0",
    "react": "^15.0.1",
    "react-addons-test-utils": "^15.0.1",
    "react-dnd": "~2.1.4",
    "react-dnd-html5-backend": "~2.0.0",
    "react-dom": "^15.0.1",
    "react-router": "^2.6.0",
    "request-promise": "^4.1.1",
    "sass-loader": "~3.1.2",
    "style-loader": "~0.12.3",
    "svg-prep": "~1.0.0",
    "transform-jest-deps": "^2.1.0",
    "webpack": "~1.12.0"
  },
  "scripts": {
    "dev": "node ./Parse-Dashboard/index.js & webpack --config webpack/build.config.js --devtool eval-source-map --progress --watch",
    "dashboard": "node ./Parse-Dashboard/index.js & webpack --config webpack/build.config.js --progress --watch",
    "pig": "http-server ./PIG -p 4041 -s & webpack --config webpack/PIG.config.js --progress --watch",
    "build": "NODE_ENV=production webpack --config webpack/production.config.js && webpack --config webpack/PIG.config.js",
    "test": "NODE_PATH=./node_modules jest",
    "generate": "node scripts/generate.js",
    "prepublish": "webpack --config webpack/publish.config.js",
    "start": "node ./Parse-Dashboard/index.js"
  },
  "bin": {
    "parse-dashboard": "./bin/parse-dashboard"
  },
  "engines": {
    "node": "7.6.0"
  },
  "main": "Parse-Dashboard/app.js",
  "jest": {
    "testPathDirs": [
      "src/lib"
    ],
    "scriptPreprocessor": "<rootDir>/testing/preprocessor.js",
    "testDirectoryName": "tests",
    "testFileExtensions": [
      "test.js"
    ],
    "unmockedModulePathPatterns": [
      "react",
      "react-dom",
      "react-addons-test-utils",
      "fbjs"
    ]
  }
}

如果我在此项目的根级别运行“ npm install ”,我将收到此错误:

npm WARN prepublish-on-install As of npm@5, `prepublish` scripts will run only for `npm publish`.
npm WARN prepublish-on-install (In npm@4 and previous versions, it also runs for `npm install`.)
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> parse-dashboard@1.0.25 prepublish /mypath/-dashboard-advanced
> webpack --config webpack/publish.config.js

sh: webpack: command not found
npm ERR! addLocal Could not install /mypath/-dashboard-advanced
npm ERR! addLocal Could not install /mypath/-dashboard-simple
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.6.0
npm ERR! npm  v4.1.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! parse-dashboard@1.0.25 prepublish: `webpack --config webpack/publish.config.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the parse-dashboard@1.0.25 prepublish script 'webpack --config webpack/publish.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the parse-dashboard package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack --config webpack/publish.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs parse-dashboard
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls parse-dashboard
npm ERR! There is likely additional logging output above.

所以我的理解是在预发布脚本中需要webpack但是找不到它。但是我故意在根项目或本地模块中添加了webpack作为依赖项(在开发和生产依赖中只是为了安全),为什么还没有找到webpack?

0 个答案:

没有答案