简体   繁体   English

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

[英]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. 尝试在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 这是我的package.json,请让我知道一些特定于Mac的脚本,可能会导致上述错误,根据我的分析,它是围绕服务器或更新的: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. 从在Mac上进行npm install到在Window上进行npm install ,可能会发生单色版本更改。 So, it is advised to keep the package-lock.json in git and update it whenever you are updating your package.json . 因此,建议将package-lock.json在git中,并在每次更新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. 我相信您可以通过调用堆栈确定导致节点模块出现问题的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 mkdir -p在Windows的package.json脚本中不起作用 - mkdir -p doesn't work in package.json script on Windows npm run watch不运行:没有这样的文件或目录,请打开“ /Users/usr/package.json” - npm run watch doesn't run: no such file or directory, open '/Users/usr/package.json' 将 package.json 脚本从 mac 更改为 windows - change package.json script from mac to windows Windows上的package.json脚本不会运行“ grunt watch” - 'grunt watch' won't run from a package.json script on Windows `npm build` 不运行 package.json 中名为“build”的脚本 - `npm build` doesn't run the script named “build” in package.json 为什么我不能在不调用脚本的情况下运行与我的 package.json 脚本相同的命令? - Why I can't run the same command that is my script of package.json without calling the script? “npm install [package]”不更新 package.json - "npm install [package]" doesn't update package.json 在Windows上的package.json中外部定位的'npm run'脚本? - Externally-located 'npm run' scripts in package.json on Windows? npm package.json bin不能在Windows上运行 - npm package.json bin won't work on Windows PhpStorm 无法识别本地目录的 package.json 名称 - PhpStorm doesn't recognize package.json name of local directories
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM