简体   繁体   中英

same package.json doesn't run in windows and mac

I am getting the following error when I am try to start my app in windows.

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

Any explanations or packages that I am missing?

Here is my package.json, please let me know some of the scripts that are mac specific and might lead to the above error, from my analysis it is around server or update:watch 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"
  }
}

Sometimes minor version changes can break things. There might be some monor version change happened from the time you did npm install on your Mac and by the time you did on Window. So, it is advised to keep the package-lock.json in git and update it whenever you are updating your package.json . Also, not that not all packages are compatible with all the platforms. I am sure you can identify the problem causing node module by the call stack.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM