簡體   English   中英

npm生產版本問題(npm版本內部版本-Pprod)

[英]npm production build issue (npm version build -Pprod)

版本

c:\dev\sam>npm -v
5.5.1

c:\dev\sam>node -v
v8.9.2

c:\dev\sam>

問題

c:\dev\sam> mvnw -Pprod -DskipTests package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SAM 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
...
[INFO] --- frontend-maven-plugin:1.4:install-node-and-npm (install node and npm) @ sam ---
[INFO] Node v6.11.0 is already installed.
[INFO] NPM 5.0.3 is already installed.
...
INFO] ERROR in ./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js!./src/main/webapp/content/scss/global.scss
[INFO] Module build failed: Error: Missing binding c:\dev\sam\node_modules\node-sass\vendor\win32-x64-48\binding.node
[INFO] Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x
[INFO]
[INFO] Found bindings for the following environments:
[INFO]   - Windows 64-bit with Node.js 8.x
[INFO]
[INFO] This usually happens because your environment has changed since running `npm install`.
[INFO] Run `npm rebuild node-sass` to download the binding for your current environment.
...
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.684 s
[INFO] Finished at: 2018-07-12T06:56:14+01:00
[INFO] Final Memory: 35M/501M
[INFO] ------------------------------------------------------------------------

的package.json

c:\dev\sam>more package.json
{
  "name": "sam",
  "version": "0.0.0",
  "description": "Description for SAM",
  "private": true,
  "cacheDirectories": [
    "node_modules"
  ],
  "dependencies": {
    "@angular/animations": "5.2.10",
    "@angular/cdk": "5.2.5",
    "@angular/common": "5.2.0",
    "@angular/compiler": "5.2.0",
    "@angular/core": "5.2.0",
    "@angular/forms": "5.2.0",
    "@angular/http": "5.2.0",
    "@angular/material": "5.2.5",
    "@angular/platform-browser": "5.2.0",
    "@angular/platform-browser-dynamic": "5.2.0",
    "@angular/router": "5.2.0",
    "@ng-bootstrap/ng-bootstrap": "1.0.0",
    "angular-calendar": "^0.25.1",
    "angular-highcharts": "6.0.0",
    "bootstrap": "4.0.0",
    "core-js": "2.4.1",
    "font-awesome": "4.7.0",
    "highcharts": "6.1.0",
    "jquery": "3.2.1",
    "lodash": "4.17.5",
    "ng-jhipster": "0.4.0",
    "ng2-nouislider": "1.7.7",
    "ng2-pdf-viewer": "4.1.2",
    "ngx-cookie": "2.0.1",
    "ngx-infinite-scroll": "0.5.1",
    "ngx-stripe": "0.8.2",
    "ngx-webstorage": "2.0.1",
    "nouislider": "11.1.0",
    "reflect-metadata": "0.1.10",
    "rxjs": "5.5.6",
    "sockjs-client": "1.1.4",
    "swagger-ui": "2.2.10",
    "tether": "1.4.0",
    "webstomp-client": "1.0.6",
    "zone.js": "0.8.19",
    "popper.js": "^1.12.9"
  },
  "devDependencies": {
    "@angular/cli": "1.6.6",
    "@angular/compiler-cli": "5.2.0",
    "@ngtools/webpack": "1.8.5",
    "@types/highcharts": "5.0.22",
    "@types/jasmine": "2.5.53",
    "@types/lodash": "4.14.107",
    "@types/node": "8.0.18",
    "angular2-template-loader": "0.6.2",
    "awesome-typescript-loader": "3.2.2",
    "browser-sync": "2.18.13",
    "browser-sync-webpack-plugin": "1.2.0",
    "codelyzer": "4.0.1",
    "copy-webpack-plugin": "4.2.3",
    "css-loader": "0.28.4",
    "exports-loader": "0.6.4",
    "extract-text-webpack-plugin": "3.0.2",
    "file-loader": "1.1.5",
    "generator-jhipster": "4.14.3",
    "html-loader": "0.5.0",
    "html-webpack-plugin": "2.30.1",
    "jasmine-core": "2.7.0",
    "karma": "1.7.1",
    "karma-chrome-launcher": "2.2.0",
    "karma-coverage": "1.1.1",
    "karma-intl-shim": "1.0.3",
    "karma-jasmine": "1.1.0",
    "karma-junit-reporter": "1.2.0",
    "karma-notify-reporter": "1.0.1",
    "karma-phantomjs-launcher": "1.0.4",
    "karma-remap-istanbul": "0.6.0",
    "karma-sourcemap-loader": "0.3.7",
    "karma-webpack": "2.0.4",
    "node-sass": "^4.9.2",
    "phantomjs-prebuilt": "2.1.16",
    "postcss-loader": "2.0.9",
    "proxy-middleware": "0.15.0",
    "rimraf": "2.6.1",
    "sass-loader": "6.0.6",
    "source-map": "0.6.1",
    "sourcemap-istanbul-instrumenter-loader": "0.2.0",
    "style-loader": "0.18.2",
    "to-string-loader": "1.1.5",
    "tslint": "5.5.0",
    "tslint-loader": "3.5.3",
    "typescript": "2.6.2",
    "uglifyjs-webpack-plugin": "1.1.5",
    "web-app-manifest-loader": "0.1.1",
    "webpack": "3.10.0",
    "webpack-dev-server": "2.9.5",
    "webpack-merge": "4.1.1",
    "webpack-notifier": "1.5.1",
    "webpack-visualizer-plugin": "0.1.11",
    "workbox-webpack-plugin": "3.0.0-beta.1",
    "write-file-webpack-plugin": "4.1.0",
    "xml2js": "0.4.17"
  },
  "engines": {
    "node": ">=6.9.0"
  },
  "resolutions": {
    "source-map": "0.6.1"
  },
  "scripts": {
    "lint": "tslint --project tsconfig.json -e 'node_modules/**'",
    "lint:fix": "npm run lint -- --fix",
    "ngc": "ngc -p tsconfig-aot.json",
    "cleanup": "rimraf target/{aot,www}",
    "clean-www": "rimraf target//www/app/{src,target/}",
    "start": "npm run webpack:dev",
    "serve": "npm run start",
    "build": "npm run webpack:prod",
    "test": "npm run lint && karma start src/test/javascript/karma.conf.js",
    "test:watch": "npm test -- --watch",
    "webpack:dev": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --progress --inline --hot --profile --port=9060 --watch-content-base",
    "webpack:build:main": "npm run webpack -- --config webpack/webpack.dev.js --progress --profile",
    "webpack:build": "npm run cleanup && npm run webpack:build:main",
    "webpack:prod:main": "npm run webpack -- --config webpack/webpack.prod.js --profile",
    "webpack:prod": "npm run cleanup && npm run webpack:prod:main && npm run clean-www",
    "webpack:test": "npm run test",
    "webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
    "webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js",
    "postinstall": "node node_modules/phantomjs-prebuilt/install.js"
  }
}

我不確定為什么會失敗。

開發人員版本運行正常。

產品生成失敗(從未成功)。

出於某種原因,也許npm正在尋找不同版本的nodejs(6),而不是我已安裝的版本(8)。

我確實有一個綁定文件,但是沒有構建所需的文件。

我清理了我的node_modules並再次安裝,但這並沒有解決問題。

我已經嘗試過npm rebuild node-sass,但是也許這是下載那里的版本(8)而不是(6)?

我應該“降級”到6嗎? 或如何升級版本?

關於如何解決這個問題的任何建議,以及上述原因是什么?

正確的配置應該是什么?

注意:這是一個jhipster生成的項目(如果有任何區別)。

感謝您花100萬美元花時間解釋這一點。

親切的問候,Fergal。

產品構建不使用您在PC上安裝的節點的版本,而是在pom.xml中指定的節點子文件夾下本地安裝一個版本。 因此,您可以嘗試編輯pom.xml並使用與PC相同版本的node和npm。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM