我尝试在Angular项目上重新安装node_modules(npm i
)时遇到问题。我曾经在节点v7和npm v4上,现在更新到最新的LTS但没有解决任何问题。
它工作正常,直到格林威治标准时间凌晨12:00左右。
这是我的package.json:
{
"name": "myapp",
"version": "1.4.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod --aot --locale=fr && gulp postbuild --BUILD",
"test": "npm run lint && npm run test:once",
"test:serve": "ng test",
"test:once": "ng test --watch=false --code-coverage",
"test:headless": "ng test -c karma-ci.conf.js --watch=false --code-coverage",
"lint": "ng lint --type-check",
"validate": "npm run lint && ng test --watch=false"
},
"private": true,
"dependencies": {
"@angular/animations": "^4.4.3",
"@angular/cdk": "2.0.0-beta.12",
"@angular/common": "^4.4.3",
"@angular/compiler": "^4.4.3",
"@angular/core": "^4.4.3",
"@angular/flex-layout": "2.0.0-beta.9",
"@angular/forms": "^4.4.3",
"@angular/http": "^4.4.3",
"@angular/material": "2.0.0-beta.12",
"@angular/platform-browser": "^4.4.3",
"@angular/platform-browser-dynamic": "^4.4.3",
"@angular/router": "^4.4.3",
"@types/chart.js": "^2.6.4",
"angular2-jwt": "^0.2.3",
"chart.js": "^2.7.0",
"classlist.js": "^1.1.20150312",
"core-js": "^2.4.1",
"file-saver": "^1.3.3",
"gulp-replace": "^0.6.1",
"hammerjs": "^2.0.8",
"intl": "^1.2.5",
"material-design-icons": "^3.0.1",
"rxjs": "^5.4.0",
"web-animations-js": "^2.3.0",
"zone.js": "^0.8.10"
},
"devDependencies": {
"@angular/cli": "1.2.6",
"@angular/compiler-cli": "^4.4.3",
"@angular/language-service": "^4.4.3",
"@compodoc/compodoc": "^1.0.0-beta.8",
"@types/googlemaps": "^3.26.17",
"@types/hammerjs": "^2.0.34",
"@types/jasmine": "2.5.45",
"@types/node": "~6.0.60",
"codelyzer": "~3.1.2",
"del": "^3.0.0",
"gulp": "^3.9.1",
"gulp-maven-deploy": "^1.0.1",
"jasmine-core": "~2.7.0",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.3.0",
"tslint": "~5.5.0",
"typescript": "~2.6.2"
}
}
堆栈跟踪如下:
> coffee-script@1.12.8 postinstall C:\Users\merlosy\workspace\myapp\myapp-front\node_modules\coffee-script
> node --eval 'if (require("./package.json").name === "coffee-script") { var red, yellow, cyan, reset; red = yellow = cyan = reset = ""; if (!process.env.NODE_DISABLE_COLORS) { r
ed = "\x1b[31m"; yellow = "\x1b[33m"; cyan = "\x1b[36m"; reset = "\x1b[0m"; } console.warn(red + "CoffeeScript has moved!" + reset + " Please update references to " + yellow + "\
"coffee-script\"" + reset + " to use " + yellow + "\"coffeescript\"" + reset + " (no hyphen) instead."); console.warn("Also, a new major version has been released under the " + y
ellow + "coffeescript" + reset + " name on NPM. This new release targets modern JavaScript, with minimal breaking changes. Learn more at " + cyan + "http://coffeescript.org" + re
set + "."); console.warn(""); }'
[eval]:1
'if
^^^
SyntaxError: Invalid or unexpected token
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:635:30)
at evalScript (bootstrap_node.js:462:27)
at startup (bootstrap_node.js:163:9)
at bootstrap_node.js:608:3
npm WARN ts-simple-ast@0.86.0 requires a peer of typescript@2.6.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! coffee-script@1.12.8 postinstall: `node --eval 'if (require("./package.json").name === "coffee-script") { var red, yellow, cyan, reset; red = yellow = cyan = reset = "";
if (!process.env.NODE_DISABLE_COLORS) { red = "\x1b[31m"; yellow = "\x1b[33m"; cyan = "\x1b[36m"; reset = "\x1b[0m"; } console.warn(red + "CoffeeScript has moved!" + reset + " P
lease update references to " + yellow + "\"coffee-script\"" + reset + " to use " + yellow + "\"coffeescript\"" + reset + " (no hyphen) instead."); console.warn("Also, a new major
version has been released under the " + yellow + "coffeescript" + reset + " name on NPM. This new release targets modern JavaScript, with minimal breaking changes. Learn more at
" + cyan + "http://coffeescript.org" + reset + "."); console.warn(""); }'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the coffee-script@1.12.8 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
任何人都可以复制? 任何解决方法,降级lib?
由于
答案 0 :(得分:4)
今天早些时候发布的coffeescript的1.12.8版本看起来已经破坏了这一点。 coffeescript有一个issue open,看起来这影响了很多人。
您可以通过在devDependencies中完全引用先前版本来解决它:
"devDependencies": {
...
"coffee-script": "1.12.7",
....
我建议您一直关注这个问题,并在修复后删除您的显式依赖项。
更新:已删除有问题的版本,现在应该不需要此解决方法,可以将其删除。