简短格式:
当我第一次使用'Angular'时,我遇到一个错误,告诉我没有找到tsc(最后是package.json)。
详细信息:
我是Angular的新手,而我从
npm start
我的package.json文件出现错误。 tsc: not found Error
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行中删除
tsc &&
"start": "tsc && npm run copy:html && concurrently \"npm run tsc:w\" \"npm run html:watch\" \"live-server\" ",
,我遇到以下错误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": {}
}
答案 0 :(得分:0)
我的建议是使用angular cli生成项目并检查其package.json文件,它看起来与您的有所不同