我试图用gh-pages部署我的React应用程序,但是我遇到了这个错误:“ file”参数必须是字符串类型。收到的类型未定义。
起初,我以为是我的代码,所以我制作了另一个没有修改的create-react-app,尝试使用npm run deploy
命令进行部署,但再次收到此错误消息。
我的package.json(我已经添加了homepage
链接,predeploy
和deploy
脚本以及gh-pages
依赖项):
"name": "test-deploy",
"version": "0.1.0",
"private": true,
"homepage": "https://vnsteven.github.io/test-deploy/",
"dependencies": {
"gh-pages": "^2.1.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
错误输出:
> npm run build
> test-deploy@0.1.0 build /Users/vansteven/Desktop/test-deploy
> react-scripts build
Creating an optimized production build...
Compiled successfully.
File sizes after gzip:
36.44 KB build/static/js/2.b41502e9.chunk.js
770 B build/static/js/runtime~main.90bc13d1.js
601 B build/static/js/main.74c1ab4e.chunk.js
517 B build/static/css/main.2cce8147.chunk.css
The project was built assuming it is hosted at /test-deploy/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
To publish it at https://vnsteven.github.io/test-deploy/ , run:
yarn run deploy
> test-deploy@0.1.0 deploy /Users/vansteven/Desktop/test-deploy
> gh-pages -d build
The "file" argument must be of type string. Received type undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test-deploy@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test-deploy@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/vansteven/.npm/_logs/2019-08-01T17_48_50_611Z-debug.log
le shell a retourné 1
日志:
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'deploy' ]
2 info using npm@6.9.0
3 info using node@v10.16.0
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle test-deploy@0.1.0~predeploy: test-deploy@0.1.0
6 verbose lifecycle test-deploy@0.1.0~predeploy: unsafe-perm in lifecycle true
7 verbose lifecycle test-deploy@0.1.0~predeploy: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/vansteven/Desktop/test-deploy/node_modules/.bin:/Users/vansteven/.rvm/gems/ruby-2.5.1/bin:/Users/vansteven/.rvm/gems/ruby-2.5.1@global/bin:/Users/vansteven/.rvm/rubies/ruby-2.5.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/vansteven/.rvm/bin
8 verbose lifecycle test-deploy@0.1.0~predeploy: CWD: /Users/vansteven/Desktop/test-deploy
9 silly lifecycle test-deploy@0.1.0~predeploy: Args: [ '-c', 'npm run build' ]
10 silly lifecycle test-deploy@0.1.0~predeploy: Returned: code: 0 signal: null
11 info lifecycle test-deploy@0.1.0~deploy: test-deploy@0.1.0
12 verbose lifecycle test-deploy@0.1.0~deploy: unsafe-perm in lifecycle true
13 verbose lifecycle test-deploy@0.1.0~deploy: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/vansteven/Desktop/test-deploy/node_modules/.bin:/Users/vansteven/.rvm/gems/ruby-2.5.1/bin:/Users/vansteven/.rvm/gems/ruby-2.5.1@global/bin:/Users/vansteven/.rvm/rubies/ruby-2.5.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/vansteven/.rvm/bin
14 verbose lifecycle test-deploy@0.1.0~deploy: CWD: /Users/vansteven/Desktop/test-deploy
15 silly lifecycle test-deploy@0.1.0~deploy: Args: [ '-c', 'gh-pages -d build' ]
16 silly lifecycle test-deploy@0.1.0~deploy: Returned: code: 1 signal: null
17 info lifecycle test-deploy@0.1.0~deploy: Failed to exec deploy script
18 verbose stack Error: test-deploy@0.1.0 deploy: `gh-pages -d build`
18 verbose stack Exit status 1
18 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
18 verbose stack at EventEmitter.emit (events.js:198:13)
18 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
18 verbose stack at ChildProcess.emit (events.js:198:13)
18 verbose stack at maybeClose (internal/child_process.js:982:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
19 verbose pkgid test-deploy@0.1.0
20 verbose cwd /Users/vansteven/Desktop/test-deploy
21 verbose Darwin 16.7.0
22 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy"
23 verbose node v10.16.0
24 verbose npm v6.9.0
25 error code ELIFECYCLE
26 error errno 1
27 error test-deploy@0.1.0 deploy: `gh-pages -d build`
27 error Exit status 1
28 error Failed at the test-deploy@0.1.0 deploy script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 1, true ]
此错误消息来自我全新的React应用程序。只有我的package.json已被修改。
似乎是gh-pages 2.1中的错误。
我通过将gh-pages降级到2.0版解决了我的问题:
yarn add gh-pages@2.0 -D` // or
npm install -D gh-pages@2.0
我正在开发一个electron应用程序,它试图从unsplash API下载一张照片,并将其设置为壁纸。当我调用API时,我得到200 OK状态并获得下载URL,但当我尝试使用axios stream方法下载照片时,我得到以下错误: 类型错误[ERR_INVALID_ARG_TYPE]:url参数必须是字符串类型。接收类型未定义 这是功能代码: 当我试图在函数中console.logDownloa
问题内容: 我正在React的一个项目上工作,遇到了一个让我感到困惑的问题。 每当我运行时,都会出现此错误: TypeError [ERR_INVALID_ARG_TYPE]:“路径”参数必须为字符串类型。接收类型未定义 我不知道为什么会这样,如果有人经历过,我将不胜感激。 问题答案: 要解决此问题,只需升级 react-scripts 软件包(使用来检查最新版本): 将您的 package.js
我正试图使用邮递员将图像上传到firebase。运行时,我向路由发送post请求以及授权标头和图像文件,但控制台中出现以下错误: TypeError[ERR_INVALID_ARG_TYPE]:“path”参数必须是string类型。接收类型未定义 完整错误消息:
我在React做一个项目,遇到了一个让我难堪的问题。 每当我运行时,就会出现以下错误: TypeError[ERR_INVALID_ARG_TYPE]:路径参数必须是字符串类型。接收类型未定义 我不知道为什么会发生这种情况,如果有人经历过这种情况,我将不胜感激。
我正在使用v12.2.0库编写一个discord bot,出现以下错误: 等待dTypeError[ERR_INVALID_ARG_TYPE]:id参数必须是字符串类型。收到未定义 这是我的代码:
在以下代码中,我得到了此错误: TypeError[ERR_INVALID_ARG_TYPE]:原始参数的类型必须是Function。接收类型未定义 它说问题在第31行: 我在使用promisify图书馆时遇到问题。