相同的package.json不能在Windows和Mac中运行

时间:2019-08-09 17:14:17

标签: node.js angular npm

尝试在Windows中启动我的应用程序时出现以下错误。

basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
[0]           ^^^^
[0] ^^^
[0]
[0] SyntaxError: missing ) after argument list

我缺少任何解释或软件包吗?

这是我的package.json,请让我知道一些特定于Mac的脚本,可能会导致上述错误,根据我的分析,它是关于服务器或更新的: package.json

{
  "name": "documentation-playground",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "concurrently --kill-others \"npm run server\" \"npm run update:watch\"",
    "server": "node --max_old_space_size=8192  ./node_modules/.bin/ng serve --aot --progress false --proxy-config proxy.config.json --port 8888",
    "mock": "node json-server/json-server.js",
    "update:watch": "onchange \"json-server/**/*.json\" -i -- npm run mock",
    "npm-install": "rimraf ./src/app/core && rimraf ./node_modules/woa-core-ng-module && npm i",
    "test": "concurrently --kill-others  \"npm run mock\" \"ng test --source-map=false\"",
    "start-prod": "concurrently --kill-others \"npm run server-prod\" \"npm run update:watch\"",
    "server-prod": "ng serve --configuration=production --progress true --proxy-config proxy.config.json",
    "start-demo": "ng serve --configuration=demo",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor",
    "lint": "ng lint",
    "build:clean": "rimraf ./dist/public",
    "prebuild": "npm run build:clean",
    "build:aot": "./node_modules/.bin/ng build --aot",
    "build": "./node_modules/.bin/ng build --prod --configuration=production --deploy-url=documentation-playground/",
    "prebuild:demo": "npm run build:clean",
    "build:demo": "./node_modules/.bin/ng build --prod --configuration=demo --deploy-url=documentation-playground/",
    "postbuild:demo": "mv ./dist/public/documentation-playground/documentation-playground-index.html ./dist/public/documentation-playground/index.html",
    "postbuild": "rimraf ./dist/public/documentation-playground/assets/i18n/en.json"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/router": "^6.1.0",
    "core-js": "^2.5.4",
    "rxjs": "6.3.3",
    "zone.js": "~0.8.26",
    "@ngx-translate/core": "10.0.0",
    "@ngx-translate/http-loader": "3.0.0",
    "classlist.js": "1.1.20150312",
    "jsonschema": "1.1.1",
    "moment": "^2.18.1",
    "ngx-drag-drop": "^1.1.0",
    "ngx-perfect-scrollbar": "^7.0.0",
    "ngx-responsive": "6.0.0",
    "ngx-translate-multi-http-loader": "^2.1.2",
    "resize-observer-polyfill": "^1.5.0",
    "stacktrace-js": "2.0.0",
    "web-animations-js": "^2.3.1",
    "cp-cli": "^1.1.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.6.7",
    "@angular/cli": "~6.1.2",
    "fs": "0.0.1-security",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^5.4.2",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2",
    "onchange": "^3.2.1",
    "concurrently": "3.4.0",
    "json-server": "0.9.6",
    "rimraf": "2.6.2"
  }
}

1 个答案:

答案 0 :(得分:0)

有时,较小的版本更改可能会破坏事情。从您在Mac上执行npm install到Windows期间,可能会发生一些单色版本更改。因此,建议将package-lock.json保留在git中,并在每次更新package.json时对其进行更新。另外,并非所有软件包都与所有平台兼容。我相信您可以通过调用堆栈确定导致节点模块出现问题的原因。