相关疑难解决方法(0)

npm安装包在哪里?

有人能告诉我在哪里可以找到我安装的Node.js模块npm吗?

javascript location node.js npm

867
推荐指数
16
解决办法
60万
查看次数

这不是您正在寻找的 tsc 命令

当我tsc在终端中运行时(无论在哪里)我都会返回:

$ npx tsc --version

                This is not the tsc command you are looking for


To get access to the TypeScript compiler, tsc, from the command line either:

- Use npm install typescript to first add TypeScript to your project before using npx
- Use yarn to avoid accidentally running code from un-installed packages
Run Code Online (Sandbox Code Playgroud)

据我所知,我没有在全球范围内安装 TypeScript,所以我期望它找不到tsc.

npm typescript tsc

52
推荐指数
7
解决办法
4万
查看次数

如何在npm中本地安装和运行Typescript?

我想安装并运行Typescript(即没有全局依赖).

这是我的package.json文件:

{
  "name": "foo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "tsc": "tsc"
  },
  "devDependencies": {
    "typescript": "^1.8.10"
  },
  "author": "",
  "license": "ISC"
}
Run Code Online (Sandbox Code Playgroud)

然后我跑:

npm install
npm run tsc
Run Code Online (Sandbox Code Playgroud)

但是,当我运行第二个命令时,我得到很多错误,它无法显示所有错误.大部分内容如下:

../foo/node_modules/typescript/lib/lib.d.ts(5015,5): error TS2300: Duplicate identifier 'webkitTransformOrigin'.
../foo/node_modules/typescript/lib/lib.d.ts(5016,5): error TS2300: Duplicate identifier 'webkitTransformStyle'.
../foo/node_modules/typescript/lib/lib.d.ts(5017,5): error TS2300: Duplicate identifier 'webkitTransition'.
../foo/node_modules/typescript/lib/lib.d.ts(5018,5): error TS2300: Duplicate identifier 'webkitTransitionDelay'.
../foo/node_modules/typescript/lib/lib.d.ts(5019,5): error TS2300: Duplicate identifier 'webkitTransitionDuration'.
../foo/node_modules/typescript/lib/lib.d.ts(5020,5): error TS2300: Duplicate identifier 'webkitTransitionProperty'.
Run Code Online (Sandbox Code Playgroud)

在npm-debug.log中我得到:

0 …
Run Code Online (Sandbox Code Playgroud)

node.js npm typescript

32
推荐指数
5
解决办法
7万
查看次数

如何知道在angular 4项目上运行哪些打字稿版本

所以我做了ng -v它向我展示除了打字稿之外的一切,所以我如何检查我的角度4项目的Typescript版本.

typescript angular

24
推荐指数
5
解决办法
5万
查看次数

如何将我的Typescript Node.js应用程序部署到Heroku?

在本地测试我以前运行:

"build-live": "nodemon --exec ./node_modules/.bin/ts-node -r dotenv/config -- ./index.ts"
Run Code Online (Sandbox Code Playgroud)

然后我想我的Procfile应该是这样的:

web: ./node_modules/.bin/ts-node -- ./index.ts
Run Code Online (Sandbox Code Playgroud)

但它说模块'typescript'没有找到,即使它在package.json.我在几个地方读到了ts-node不能部署到Heroku的方法,所以我不知道该怎么办.

更新:我想我应该编译它,所以我试过:

web: ./node_modules/.bin/tsc --module commonjs --allowJs --outDir build/ --sourceMap --target es6 index.ts && node build/index.js
Run Code Online (Sandbox Code Playgroud)

这成功了,但是当实际运行它时,我正在使用的一堆lib得到"找不到模块'......'".

heroku node.js typescript

6
推荐指数
3
解决办法
7269
查看次数

使用 Gitlab CI docker-in-docker 时如何修复 docker 容器中的“sh: tsc not found”错误

我正在为一个项目设置 Gitlab CI docker-in-docker。不幸的是,该作业一直失败,因为在运行命令时似乎找不到已安装的 NPM 包。我得到的错误:

backend_1   | 
backend_1   | > tacta-backend@0.0.1 build /app
backend_1   | > tsc
backend_1   | 
backend_1   | sh: tsc: not found
backend_1   | npm ERR! file sh
backend_1   | npm ERR! code ELIFECYCLE
backend_1   | npm ERR! errno ENOENT
backend_1   | npm ERR! syscall spawn
backend_1   | npm ERR! tacta-backend@0.0.1 build: `tsc`
backend_1   | npm ERR! spawn ENOENT
backend_1   | npm ERR! 
backend_1   | npm ERR! Failed at the tacta-backend@0.0.1 build script.
backend_1   | npm …
Run Code Online (Sandbox Code Playgroud)

npm docker gitlab-ci devops

5
推荐指数
1
解决办法
7112
查看次数

标签 统计

npm ×4

typescript ×4

node.js ×3

angular ×1

devops ×1

docker ×1

gitlab-ci ×1

heroku ×1

javascript ×1

location ×1

tsc ×1