繁体   English   中英

package.json中的角度启动错误

[英]Angular starting errors in package.json

简写:

第一次使用“ Angular”时,我遇到一个错误,告诉我未找到tsc(末尾是package.json)。

详情:

我是Angular的新手,虽然我从一本书中使用npm start示例,但是我的package.json文件运行在错误中。 tsc:未找到错误

sh: 1: tsc: not found

npm ERR! blog-app@1.0.0 start: `tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" `
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the blog-app@1.0.0 start script.
npm ERR! This is most likely a problem with the blog-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server"
npm ERR! You can get their info via:
npm ERR!     npm owner ls blog-app
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.14.62-v7+
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! cwd /home/pi/webpages/3914_Zusatzmaterialien/kickstart/hello-angular
npm ERR! node -v v8.11.1
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/webpages/3914_Zusatzmaterialien/kickstart/hello-angular/npm-debug.log
npm ERR! not ok code 0

我应该在该分发目录中运行npm install ,导致出现以下错误:

(node:1635) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
npm WARN package.json blog-app@1.0.0 No README data
npm WARN deprecated typings@1.0.4: Typings is deprecated in favor of NPM @types -- see README for more information
npm ERR! Error: Method Not Allowed
npm ERR!     at errorResponse (/usr/share/npm/lib/cache/add-named.js:260:10)
npm ERR!     at /usr/share/npm/lib/cache/add-named.js:203:12
npm ERR!     at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:167:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:135:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 4.14.62-v7+
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi/webpages/angulartry
npm ERR! node -v v8.11.1
npm ERR! npm -v 1.4.21
npm ERR! code E405
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/webpages/angulartry/npm-debug.log
npm ERR! not ok code 0

我多次删除了它,并使用npm install -g typescript重新安装了它。

npm install && npm start导致以下错误

(node:1814) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
npm WARN package.json blog-app@1.0.0 No README data
npm WARN deprecated typings@1.0.4: Typings is deprecated in favor of NPM @types -- see README for more information
npm ERR! Error: Method Not Allowed
npm ERR!     at errorResponse (/usr/share/npm/lib/cache/add-named.js:260:10)
npm ERR!     at /usr/share/npm/lib/cache/add-named.js:203:12
npm ERR!     at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:167:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:135:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 4.14.62-v7+
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi/webpages/3914_Zusatzmaterialien/kickstart/hello-angular
npm ERR! node -v v8.11.1
npm ERR! npm -v 1.4.21
npm ERR! code E405
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/webpages/3914_Zusatzmaterialien/kickstart/hello-angular/npm-debug.log
npm ERR! not ok code 0

如果我从第11行"start": "tsc && npm run copy:html && concurrently \\"npm run tsc:w\\" \\"npm run html:watch\\" \\"live-server\\" ",删除了tsc && "start": "tsc && npm run copy:html && concurrently \\"npm run tsc:w\\" \\"npm run html:watch\\" \\"live-server\\" ", ,,我在以下错误sh: 1: copyfiles: not found运行sh: 1: copyfiles: not found

关于系统:

系统正在使用npm版本npm: '1.4.21' Raspbian Raspberry Pi上运行。 我的打字稿版本似乎是2.2.1。 如果有问题,我可以通过腻子控制系统。

package.json文件:

{
  "name": "blog-app",
  "version": "1.0.0",
  "description": "Blog Applikation",
  "watch": {
    "copy:html": "./app/**/*.html"
  },
  "scripts": {
    "tsc": "./node_modules/.bin/tsc",
    "tsc:w": "./node_modules/.bin/tsc --watch",
    "start": "tsc && npm run copy:html && concurrently \"npm run tsc:w\" \"npm run html:watch\" \"live-server\" ",
    "html:watch": "onchange \"./app/**/*.html\" -v -- npm run copy:html",
    "copy:html": "copyfiles -u 1 ./app/**/*.html dist"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@angular/common": ">=4.0.0-beta <5.0.0",
    "@angular/compiler": ">=4.0.0-beta <5.0.0",
    "@angular/core": ">=4.0.0-beta <5.0.0",
    "@angular/forms": ">=4.0.0-beta <5.0.0",
    "@angular/http": ">=4.0.0-beta <5.0.0",
    "@angular/platform-browser": ">=4.0.0-beta <5.0.0",
    "@angular/platform-browser-dynamic": ">=4.0.0-beta <5.0.0",
    "systemjs": "0.19.27",
    "core-js": "2.4.1",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.1.0",
    "zone.js": "0.8.4",
    "bootstrap": "3.3.6"
  },
  "devDependencies": {
    "canonical-path": "0.0.2",
    "concurrently": "2.2.0",
    "copyfiles": "1.0.0",
    "http-server": "0.9.0",
    "live-server": "1.1.0",
    "lodash": "4.11.1",
    "npm-watch": "0.1.6",
    "onchange": "3.0.2",
    "rimraf": "2.5.2",
    "tslint": "3.7.4",
    "typescript": "2.2.0",
    "typings": "1.0.4"
  },
  "repository": {}
}

看来typescript没有成功安装。 你可以试试 :

npm install -g typescript

接着

npm install && npm start

我的建议是使用angular cli生成项目并检查其package.json文件,它看起来与您的有所不同

暂无
暂无

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

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