Skip to content

npm run build在特定环境下失败 #23

@chenyulun

Description

@chenyulun

npx版本7.3.0 npm版本7.3.0 node版本15.5.0
报错信息如下

 ~/github/hummer-cli   main ●  npm run build

> @hummer/cli-plugins@1.0.0 build
> lerna run build

lerna notice cli v3.22.1
lerna info Executing command in 7 packages: "npm run build"
lerna ERR! npm run build exited 236 in '@hummer/cli-utils'
lerna ERR! npm run build stdout:

> @hummer/cli-utils@0.1.16 build
> npx ../../node_modules/.bin/tsc


lerna ERR! npm run build stderr:
npm ERR! code ENOTDIR
npm ERR! syscall open
npm ERR! path /Users/chenyulun390/github/hummer-cli/node_modules/.bin/tsc/package.json
npm ERR! errno -20
npm ERR! ENOTDIR: not a directory, open '/Users/chenyulun390/github/hummer-cli/node_modules/.bin/tsc/package.json'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/chenyulun390/.npm/_logs/2021-04-26T10_17_34_940Z-debug.log
npm ERR! code 236
npm ERR! path /Users/chenyulun390/github/hummer-cli/packages/cli-utils
npm ERR! command failed
npm ERR! command sh -c npx ../../node_modules/.bin/tsc

报错分析:
当前版本npx的第二个参数需要是一个带有package.json的包,或者可执行文件的名称
我把

{
"build": "npx ../../node_modules/.bin/tsc"
}

替换成下面这段段就行了

{
"build": "npx tsc"
}

简单的方法是搜索../../node_modules/.bin/全部替换为空

希望修改一下构建问题,谢谢

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions